
863 P.2d 1022 (1993)
John E. (Jack) TAYLOR, Contestant and Appellant,
v.
Elyse "Lee" MATEJOVSKY, Contestee and Respondent.
No. 93-181.
Supreme Court of Montana.
Submitted on Briefs August 12, 1993.
Decided November 16, 1993.
*1023 Arnie A. Hove, Circle, for contestant and appellant.
Laura Christoffersen, Christoffersen & Knierim, Wolf Point, for contestee and respondent.
TRIEWEILER, Justice.
John E. Taylor filed a petition in the District Court for the Fifteenth Judicial District in Roosevelt County pursuant to § 13-36-101(2), MCA, to contest the election of Elyse Matejovsky to the County Commission from District 2 in Roosevelt County. The District Court dismissed his petition. Taylor appeals the order of the District Court.
We reverse and remand with instructions.
The following issues are raised on appeal:
1. Did the District Court err when it denied Taylor's motion for substitution of the District Court Judge?
2. Did the District Court err when it refused to allow Taylor to present evidence through the testimony of witnesses, other than the contestant and contestee, at the hearing on Taylor's petition?
3. Did the District Court err when it dismissed Taylor's petition contesting the *1024 election of the District 2 Roosevelt County Commissioner?
Elyse Matejovsky was elected to the County Commission from District 2 in Roosevelt County in November 1992. On January 29, 1993, Taylor, Matejovsky's opponent in the Commission race, filed a petition contesting her election pursuant to § 13-36-101(2), MCA. The petition alleged that Matejovsky was not qualified to file for the office of County Commissioner in District 2 because she was not a resident of that district at the time she filed for the primary election. Matejovsky was served with notice on February 2, 1993, and was summoned to appear at a hearing scheduled for February 5.
On February 2, Taylor moved for a substitution of the District Court Judge pursuant to § 3-1-804, MCA. At the February 5 hearing, Taylor's motion for substitution of judge was denied for the reason that it had not been timely filed. The court offered the following rationale for its determination that the motion was untimely:
Okay, I will take judicial notice of the statute that says that an affidavit of disqualification is  if it's not filed timely, is  has no effect, and I'm relying on this not being filed timely. This matter, I believe, the record reflects that the petition in this matter was drafted  or filed  drafted the 10th of November of '92  filed the 29th of January of '93, served the 5th of February, '93, and the substitution was filed the 2nd and served the 3rd, so I find that that's not timely, and you can proceed.
During the hearing, it was established that Matejovsky filed for the primary election on March 12, 1992. It was undisputed that § 7-4-2104(2), MCA, and the certificate establishing the existing plan of government for Roosevelt County, require a candidate, at the time of filing for the primary election, to be a resident of the district from which he or she seeks election.
Matejovsky admitted that, at the time of her entry into the commissioner race, she was "sleeping and eating" at a location outside of Commissioner District 2. However, Matejovsky claimed that her permanent residence was the family farm, which was located within District 2, and that her move from the farm had only been a temporary arrangement after her husband's death. It was her assertion that she never intended to change her permanent residence from the family farm despite the fact that she had not been living at the farm since the fall of 1990.
Only Matejovsky and Taylor were allowed to offer testimony at the hearing. The court did not allow Taylor to offer testimony from additional witnesses based on its determination that § 13-36-207, MCA, permitted testimony from only the parties to the action, unless otherwise ordered by the court.
On March 11, 1993, the court issued its findings of fact, conclusions of law, and order dismissing Taylor's petition contesting the election. The court found that the purposes for which Matejovsky left her residence in Commissioner District 2 were "temporary or special" and concluded, based on the evidence presented by the parties, that there had been no union of act and intent as required for a change of residence under § 1-1-215(6), MCA. Therefore, it concluded that Matejovsky was a proper candidate for election as commissioner to District 2 and dismissed Taylor's petition for ouster. Pursuant to § 13-36-205, MCA, Taylor was ordered to reimburse Matejovsky, as the prevailing party, for costs, disbursements, and reasonable attorney fees incurred in defense of this action. From this order, Taylor appeals.

I.
Did the District Court err when it denied Taylor's motion for substitution of the District Court Judge?
Montana law entitles each adverse party in a civil or criminal case to one substitution of a district court judge. Section 3-1-804, MCA. Once a timely motion has been filed, the substituted judge is without jurisdiction to act on the merits of the cause or to decide legal issues therein. *1025 Section 3-1-804(1)(a), MCA. Section 3-1-804(1)(c), MCA, clarifies that when a judge is assigned to a cause for 20 consecutive days after service of summons and no motion for substitution has been filed, the right to move for substitution is deemed waived. The judge for whom substitution is sought has jurisdiction to determine timeliness, and any motion for substitution which is not timely filed is void. Section 3-1-804(1)(e), MCA.
In this instance, the court's rationale in denying the motion for substitution offers little explanation of its determination of untimeliness. The reference to an "affidavit of disqualification" suggests the court considered § 3-1-805, MCA, which provides for disqualification for cause, and requires an affidavit be filed at least 30 days prior to the date set for hearing. However, Taylor's motion was not filed pursuant to this statute. Taylor's motion was an exercise of the right to substitution of judge as provided for under § 3-1-804, MCA. The record demonstrates that Matejovsky was served with notice of Taylor's petition on February 2, and the motion for substitution was made on that same date. Clearly, the motion for substitution of judge was made prior to the expiration of 20 days after service of the summons. Thus, Taylor's motion was filed within the only time period provided by statute.
Matejovsky contends, however, that the court properly denied Taylor's motion because of the requirements set forth in the statute addressing election contests. She claims that the court is given unlimited discretion in determining when a motion for substitution of judge is untimely, and in this instance, Taylor's motion was unreasonable because it requested a substitution three days before a hearing which, by statute, had to be held on or before February 5, 1993. Matejovsky asserts that a substitution of judge would have necessarily delayed the hearing date past the time required in § 13-36-206, MCA.
The statute governing contests of elections provides for a prompt resolution of the dispute and requires a court to give a contest petition precedence over other pending cases. Section 13-36-206, MCA. Specifically, the statute sets forth the following procedural requirements:
Notice of filing  prompt hearing. On the filing of any such petition, the clerk shall immediately notify the judge of the court and issue a citation to the person whose nomination or office is contested, citing him to appear and answer not less than 3 or more than 7 days after the date of filing the petition. The court shall hear said cause, and every such contest shall take precedence over all other business on the court docket and shall be tried and disposed of with all convenient dispatch.
Section 13-36-206, MCA. Matejovsky argues that this section imposes a mandatory requirement that a court conduct a hearing no later than seven days after a contest petition is filed. In this instance, that date was February 5, 1993.
However, a court's function, when construing a statute, is to ascertain what it contains, "not to insert what has been omitted or to omit what has been inserted." Section 1-2-101, MCA; Gaub v. Milbank Ins. Co. (1986), 220 Mont. 424, 715 P.2d 443. The statute states that the person whose nomination is contested must "appear and answer" within the specified time frame. We construe this to mean that the contestee must make an appearance and answer the petition, but not that the court must necessarily conduct a hearing within this time period. As specified in the next sentence, the court is to conduct a hearing on a priority basis, but there is no stated requirement that the hearing be held prior to the expiration of seven days. This Court will not insert such a requirement where it has been omitted by the Legislature.
Furthermore, § 13-36-208, MCA, offers additional insight regarding the procedure involved in election contests. This section clarifies that "[p]roceedings under this title shall be advanced on the docket upon request of either party for speedy trial, but the court may postpone or continue the trial if necessary...." It is clear *1026 from this section that, although these disputes are to be resolved as promptly as possible, there is some discretion regarding postponements or continuances where necessary.
We believe that this construction of the statute in question operates to give effect to the election contest statute in its entirety, and harmonizes this statute with the provisions providing for a substitution of judge. An interpretation which mandates a prompt hearing, but not necessarily within seven days, will not deprive a party of the statutory right to a substitution of a judge even in matters such as this which are to receive expedited attention.
Based on this interpretation, we conclude that Taylor's motion for substitution of judge was made within the time allowed and the granting of the motion would not have had the effect of causing a violation of the election contest statute. Therefore, we hold that the motion was timely and that the court erred by not allowing Taylor to exercise this statutory right to substitution of the District Court Judge.
Pursuant to § 3-1-804(1)(a), MCA, once the motion for substitution of judge was timely filed, Judge Sorte was without jurisdiction to act on the merits of Taylor's petition. Accordingly, the order dismissing the petition contesting the election is vacated and this matter remanded for a new hearing after a substitution of judge.
Because the court's order is vacated, we do not need to address the question of whether the court erred when it dismissed the petition on its merits. However, for the guidance of the District Court on remand, we will address the question of whether it was proper to exclude the testimony of other witnesses during the hearing on Taylor's petition.

II.
Did the District Court err when it refused to allow Taylor to present evidence through the testimony of witnesses, other than the contestant and contestee, at the hearing on Taylor's petition?
The court based its decision to allow testimony only from Taylor and Matejovsky on § 13-36-207, MCA, which provides in relevant part:
The petitioner (contestant) and the contestee may appear and produce evidence at the hearing, but no person other than the petitioner and contestee may be made a party to the proceedings ... and no person other than the parties and their attorneys may be heard thereon except by order of the court.
Matejovsky asserts that this section clearly states that no person other than the parties may appear and present testimony or evidence unless the court so orders. Therefore, she believes it was within the court's discretion to permit only the parties to testify.
However, Taylor contends that the court, when it disallowed his offer of testimony from other witnesses, ignored the general definition of evidence as stated in § 26-1-101(2), MCA:
"Evidence" is the means of ascertaining in a judicial proceeding the truth respecting a question of fact, including but not limited to witness testimony, writings, physical objects, or other things presented to the senses. [Emphasis added].
A statute must be construed in a way that gives effect to all of its provisions. Section 1-2-101, MCA. After considering the statute as a whole, we agree with Taylor's interpretation of the statute. The statute clearly allows the contestant and contestee to produce evidence at the hearing, and we conclude this encompasses witness testimony in addition to tangible forms of evidence, such as writings, so long as it is proffered by one of the parties. Such a construction gives effect to the statute as a whole and harmonizes this statute with the general rules of evidence. It is within the court's discretion to determine the admissibility of such testimony under the general rules of evidence, but it is not to be rejected on the basis that the statute permits only the parties to the action to testify.
*1027 The order of the District Court is vacated and we remand for a new hearing on the merits of the petition after a substitution of judge.
TURNAGE, C.J., and HARRISON, GRAY, HUNT, NELSON and WEBER, JJ., concur.
