a. Right to Preliminary Hearing. When a complaint is filed charging the defendant with the commission of a felony, a preliminary hearing shall commence before a magistrate not later than 10 days following defendant's initial appearance if the defendant is in custody and not later than 20 days following defendant's initial appearance if the defendant is not in custody unless:
(1) The complaint has been dismissed;
(2) The hearing is waived; or
(3) The defendant has been transferred from the juvenile court for criminal prosecution on specified charges;
(4) The magistrate orders the hearing postponed as provided in Section (c).
b. Waiver. A preliminary hearing may be waived by written waiver, signed by the defendant, his or her counsel and the prosecutor.
c. Postponement. If a preliminary hearing has not been commenced within 10 days as required in Section (a), the defendant shall be released from custody automatically, unless he or she is charged with a non-bailable offense, whereupon the magistrate shall immediately notify the presiding judge of that county of the delay and the reasons therefor. Upon motion of any party, or on his or her own initiative, the magistrate may postpone the hearing beyond the 20-day limit specified in Section (a), upon finding that extraordinary circumstances exist and that delay is indispensable to the interests of justice, entering a written order detailing the reasons for his or her finding and giving the parties prompt notice thereof.
d. Demand for Hearing. A defendant who is in custody may demand that the preliminary hearing be held as soon as practicable, whereupon the magistrate shall commence the hearing with only such delay as is necessary to secure the attendance of counsel, court reporter and necessary witnesses.