OPINION
MINZNER, Judge.Defendant appeals his sentence for driving while under the influence of intoxicating liquor (DWI) as a fourth conviction under NMSA 1978, Section 66-8-102(E) (Cum.Supp.1990). A district court jury convicted defendant under Section 66-8-102 for an incident that occurred on March 25, 1990. At the sentencing hearing, defendant conceded that on three separate occasions in 1983 he pled guilty and was convicted of driving while intoxicated, contrary to a Farmington municipal ordinance. However, defendant argued that the municipal court convictions could not be used to enhance his sentence under the state statute. The district court considered the conviction a fourth conviction under the statute and sentenced defendant to the mandatory six month jail term followed by six months of probation provided for a “fourth and subsequent conviction.” See § 66-8-102(E)(2).
While this case was pending on appeal, defendant twice moved for release from incarceration pending disposition of his appeal. The motion was denied while the case remained assigned to the summary calendar. After the case was assigned to the general calendar, defendant renewed his motion, and following a telephonic oral argument before a panel of this court, the case was remanded for an evidentiary hearing on the question of whether defendant was entitled to release pursuant to NMSA 1978, Section 31-11-1(C) (Cum.Supp.1990). After the evidentiary hearing, defendant was released subject to conditions imposed by the district court. At that time, defendant had served six months in the San Juan County Detention Center.
Although defendant has raised five points on appeal, in effect he makes two claims of reversible error: (1) the prior convictions on which the district court relied were uncounseled convictions in which defendant had not voluntarily, knowingly, and intelligently waived his right to counsel, and (2) Section 66-8-102 does not provide for the use of prior convictions under a municipal ordinance to enhance a later conviction under the statute. We conclude the prior convictions were valid. Further, after examining the history of Section 66-8-102 and its apparent purpose, we believe there is sufficient textual support within Section 66-8-102 and in the definitions provided under the Motor Vehicle Code, see NMSA 1978, §§ 66-1-1 and -4 (Repl.Pamp.1989), to permit us to conclude that the legislature intended both district and magistrate courts to recognize a conviction under a prior municipal court ordinance in distinguishing a first offender from a subsequent offender. We are not persuaded, however, that the legislature’s purpose in providing a mandatory jail sentence for a fourth or subsequent offense requires that Subsection E(2) be construed to require a mandatory six-month term of imprisonment on these facts, and we think there is insufficient support in the text of Section 66-8-102 or elsewhere to justify such a construction.
Therefore, we reverse and remand for resentencing. On remand, the district court may take into account the existence of the three prior convictions under municipal court ordinance in deciding what sentence would be appropriate.
I.
As defendant correctly points out, prior uncounseled convictions cannot be used to enhance a sentence unless the defendant voluntarily, knowingly, and intelligently waived the right to counsel in the prior case. See State v. Watchman, 111 N.M. 727, 809 P.2d 641 (Ct.App.1991). Defendant concedes that he has three prior convictions in municipal court for DWI, and the state concedes that he did not have counsel when he pled guilty in each of those proceedings. Defendant further concedes that he signed waivers of counsel in those instances. However, defendant argues that, because of his fourth grade reading level, he could not read the waiver forms that were written at a twelfth grade level, and thus he could not voluntarily, knowingly, and intelligently waive his right to counsel.
A knowing and intelligent waiver depends on the facts and circumstances of each case. Smith v. Maldonado, 103 N.M. 570, 711 P.2d 15 (1985). The judge is required to thoroughly question the defendant to determine if the waiver is valid. Id. The inquiry is necessarily focused on the defendant’s understanding. Id. Based on the testimony in this case, the district court could properly conclude that defendant’s waivers of counsel were valid.
Defendant appeared before the same municipal court judge in each of defendant’s prior DWI cases. At trial, that judge detailed his procedure for reviewing the waiver of counsel form with defendants who pled guilty and his method of determining whether an individual defendant is making a voluntary, knowing, and intelligent waiver of counsel.
Defendant’s expert witness indicated that she believed the procedure used was adequate to ensure defendant’s understanding of the waiver form. Indeed, she testified it is the same procedure she uses to ensure her clients understand the documents she gives them to read during her testing procedures.
Defendant emphasizes that the municipal court judge never specifically stated that he followed his procedure with defendant. In fact, the judge acknowledged that he did not remember defendant ever appearing before him. Nevertheless, the judge testified that he followed the same procedure in every case.
This testimony supports a determination that defendant had in fact been questioned prior to waiving counsel and pleading guilty in each of the prior convictions. See SCRA 1986, 11-406 (evidence of habit or routine practice admissible to provide conduct on a particular occasion was in conformity with the habit or practice). Moreover, based on the expert witness’s testimony that the questioning was sufficient to ensure that defendant understood what he was doing, the district court could properly conclude there were valid waivers of counsel in the past proceedings.
Accordingly, assuming that Section 66-8-102 permits consideration of municipal ordinance convictions for enhancement purposes, the district court could consider each of these convictions. See State v. Watchman. We next address whether Section 66-8-102 permitted the court to consider municipal court convictions and, if so, whether defendant’s sentence was proper.
II.
Section 66-8-102(E) provides in relevant part that “[a] second or subsequent conviction under this section shall be punished ... by imprisonment for not less than ninety days or more than one year[.]” Id. (emphasis added). Section 66-8-102(D) provides in relevant part that “[e]very person under first conviction under this section shall be punished ... by imprisonment for not less than thirty days or more than ninety days or by a fine of not less than three hundred dollars ... or more than five hundred dollars ... or both[.]” Id. (emphasis added). Section 66-8-102(E)(1) provides a mandatory two-day jail term for a second or third conviction occurring within five years of a prior conviction. Subsection E(2) provides a mandatory six-month jail term for a fourth or subsequent conviction.1
Defendant points out that all of his prior DWI convictions were under a Farmington municipal ordinance. Since he has never been convicted of DWI under Section 66-8-102, he argues that his present conviction cannot be considered a subsequent conviction under it. His argument is premised on the view that the statute is clear and under its terms, strictly construed, he should have been sentenced for a first conviction under Subsection D. “Statutes authorizing a more severe punishment as conviction for a second offense are deemed highly penal and therefore, must be strictly construed.” State v. Keith, 102 N.M. 462, 465, 697 P.2d 145, 148 (Ct.App.1985). Alternatively, defendant contends that if the statute is not clear and therefore not to be strictly construed, the legislature’s intent is unclear, and we should resolve the issue on appeal in favor of the rule of lenity. “Doubts about the construction of criminal statutes are resolved in favor of the rule of lenity.” Id.; see also State v. Bybee, 109 N.M. 44, 46, 781 P.2d 316, 318 (Ct.App.1989); cf. State v. Edmondson, 112 N.M. 654, 818 P.2d 855 (Ct.App.1991) (discussing rule of lenity in connection with sentencing as a habitual offender).
Defendant’s primary argument is based on reading Section 66-8-102(D) in isolation. This we decline to do.
The usual rules of statutory construction would require us to read the words in context and to include in the relevant context as much of the statute as is necessary to understand the legislature’s purpose. See State v. Sinyard, 100 N.M. 694, 675 P.2d 426 (Ct.App.1983). In construing a statute, it must be read as a whole; “[e]ach section or part should be construed in connection with every other part or section so as to produce harmonious whole, ... and the court is to give effect to all provisions of a statute and to reconcile different provisions so as to make them consistent.” Id. at 697, 675 P.2d at 429 (citations omitted).
The term “under this section” appears within Section 66-8-102, which now has ten subsections, twelve times.2 One of the subsections within Section 66-8-102 specifically attempts to define the phrase “conviction under this section,” see § 66-8-102(F), and the district court relied on that subsection. We therefore consider that subsection in addressing the question of what the legislature intended.
Section 66-8-102(F) provides as follows:
In the case of a first offense under this section, the magistrate court has concurrent jurisdiction with district courts to try the offender. This section does not affect the authority of a municipality under a proper ordinance to prescribe penalties for driving while under the influence of intoxicating liquor or drugs. A conviction under a municipal ordinance prescribing penalties for driving while under the influence of intoxicating liquor or drugs shall be deemed to be a conviction under this section for purposes of determining whether a conviction in magistrate court is a second conviction. [Emphasis added.]
It is not entirely clear from the words used in Subsection F what the legislature intended the third sentence to accomplish.3 The magistrate court now has jurisdiction in all cases of misdemeanors and petty misdemeanors. See NMSA 1978, § 35-3-4(A) (Repl.Supp.1988). There does not seem to be any jurisdictional barrier to a magistrate court sentencing under either Subsection D or E.4
Thus, the first sentence of Subsection F should not be understood as limiting magistrate court jurisdiction. Cf. State v. Rue, 72 N.M. 212, 382 P.2d 697 (1963) (general statute authorizing justice of the peace to exercise jurisdiction over certain misdemeanors did not repeal justice of the peace jurisdiction over first offenses in cases of driving vehicle while intoxicated); see generally AG Op. No. 75-45 (1975) (surveying history of first sentence of Subsection F; sentence preceded enlargement of magistrate court jurisdiction under general jurisdictional statute). Rather, it appears that Section 35-3-4(A) is a general jurisdictional statute in which the legislature gradually expanded the jurisdiction of the magistrate courts, and eventually the changes in the general jurisdictional statute made the first sentence of Subsection F surplusage. Compare 1973 N.M.Laws, ch. 206, § 2 (expanding magistrate court jurisdiction to all misdemeanors) with 1968 N.M.Laws, ch. 62, § 49 (expanding magistrate court jurisdiction in all cases of misdemeanors where punishment is fine of $100 or less or imprisonment for six months or less or both).
When the legislature expanded the magistrate courts’ jurisdiction by amending Section 35-3-4(A) to include all misdemeanors, it must have envisioned that the magistrate courts and district courts would be called upon to exercise the new, concurrent jurisdiction in a manner that promoted judicial economy and served the ends of justice. We cannot imagine any legislative purpose that would be served by giving one set of courts different sentencing authority over the same offense than has been given to another set of courts with concurrent jurisdiction. Under these circumstances, we think we must take into account the legislative expansion of magistrate court jurisdiction in Section 35-3-4(A) in trying to understand the legislature’s purpose in enacting the third sentence of Subsection F.
Surely the third sentence of Subsection F can be read to provide that when a person has a prior conviction under either Section 66-8-102 or a municipal ordinance prohibiting driving while under the influence, the magistrate court judge should sentence that person for a later offense under Subsection E. We note that the third sentence of Subsection F was added in 1979, after the expansion of magistrate court jurisdiction in Section 35-3-4(A). See 1979 N.M.Laws, ch. 71, § 7. At this time, the sentence was part of a single provision, Section 66-8-102(C), that distinguished a “first conviction” from “a second or subsequent conviction.”
Further, we think the legislature has made its intent to distinguish first and subsequent offenders clear,5 and, by defining a “subsequent offender” as one who has a prior conviction under any domestic law prohibiting driving while intoxicated and a “first offender” as one who has no such prior history, has indicated its intent that a defendant with a prior conviction under a municipal ordinance be treated as a subsequent offender. We note that although the legislature defined “first offender” and “subsequent offender” effective July 1, 1990, after the date of the incident for which defendant was convicted in district court, it had previously defined both terms with similar language effective July 1, 1988, a date prior to that incident.6 It would make no sense to have the sentence for a second offense depend on which court tried the defendant. We will not construe the statute to reach an absurd result. Cf. State v. Candelaria, 113 N.M. 288, 825 P.2d 221 (Ct.App.1991) (construing district court’s authority to place a defendant convicted of a misdemeanor on probation consistent with authority of metropolitan or magistrate court). Therefore, we conclude the legislature intended that a person convicted of a municipal court ordinance would be treated as having a prior offense under Section 66-8-102 for purposes of sentencing on a later conviction under that section, whether he or she is tried for the later offense in magistrate court or district court. Id.
The next question is whether the district court was required to sentence defendant for a fourth conviction. The third sentence of Subsection F, on which the trial court relied, expressly refers only to treating a conviction under a municipal court ordinance as a second conviction. Although Subsection E refers to a “third conviction" and to a “fourth conviction” without qualification, the most recent amendment, which added those references, was enacted by the same legislature that first defined “subsequent offender” and “first offender,” and that legislature failed to say, although it would have been easy to do, whether convictions under a municipal court ordinance should be counted other than for purposes of distinguishing a first offender from a subsequent offender. For a second or subsequent conviction the district court has discretion to sentence the offender for a period of imprisonment up to one year. Thus, we need not construe the statute by adding words to it in order to permit the district court to take into account prior municipal court convictions in deciding how long a term of imprisonment is appropriate.
We recognized in State v. Greyeyes, 105 N.M. 549, 553, 734 P.2d 789, 793 (Ct.App.1987) (quoting Burch v. Foy, 62 N.M. 219, 223, 308 P.2d 199, 202 (1957)), that:
“A statute must be read and given effect as it is written by the Legislature, not as the court may think it should be or would have been written if the Legislature had envisaged all the problems and complications which might arise in the course of its administration____ Courts must take the act as they find it and construe it according to the plain meaning of the language employed.”
In this case, neither the text nor the statutory purpose makes the legislature’s intent with regard to a third or fourth conviction clear.7 Therefore, we are not certain that the legislature intended that each conviction under a municipal court ordinance would be treated as an offense under Section 66-8-102 for purposes of the most recent amendment, which imposed a mandatory jail sentence not to be suspended, deferred, or taken under advisement for a fourth or subsequent conviction. See 1988 N.M.Laws, ch. 56, § 8. Under these circumstances, Section 66-8-102(E)(2) does not provide a sufficiently clear expression of legislative intent to permit us to conclude that the district court was required to sentence defendant to six months in jail. See State v. Bybee; State v. Keith; cf. State v. Edmondson.
We conclude that defendant should have been sentenced as having a second conviction “under this section.” Because all three municipal court convictions were more than five years prior to the incident for which defendant was convicted in district court, however, the court was not required to sentence defendant to any time in jail. Rather, the court had discretion to require defendant to serve as much as one year in prison or in jail. The record indicates that the district court judge believed he was required to sentence defendant to six months as a fourth offender. Therefore, we reverse and remand with instructions to vacate defendant’s sentence and resentence him for a second conviction under Section 66-8-102(E).
CONCLUSION.
Defendant’s sentence is reversed, and the case is remanded to the district court for resentencing. Defendant should be re-sentenced as a second offender pursuant to Section 66-8-102(E).
IT IS SO ORDERED.
BIVINS, J., concurs. CHAVEZ, J., dissents.. Section 66-8-102 as it read prior to its most recent amendment only distinguished first offenses from second and subsequent offenses. See NMSA 1978, § 66-8-102(D), (E), (F) (Repl.Pamp.1987). Until the 1988 amendment, the mandatory two-day jail term now available for either certain second or a third conviction was required for certain second or subsequent convictions.
. See § 66-8-102(D) (twice); § 66-8-102(E) (once); § 66-8-102(F) (twice); § 66-8-102(G) (twice); § 66-8-102(H) (once); § 66-8-102(1) (three times); § 66-8-102(J) (once).
. Perhaps the legislature meant to refer to convictions under a municipal court ordinance tried in magistrate court pursuant to NMSA 1978, Section 35-3-4(B) (Repl.Supp.1988), but the language of the third sentence of Subsection F is not so limited. Further, we cannot think of a reason why the legislature would have distinguished municipal court ordinance violations tried in magistrate court from those tried in municipal court.
. Under the Motor Vehicle Code, it is a misdemeanor for any person to violate any provision of the Code unless the provision is declared a felony. See NMSA 1978, § 66-8-7(A) (Cum.Supp.1990). Under the Motor Vehicle Code, unless another penalty is specified, the penalty for a misdemeanor is a fine of not more than $300 or by imprisonment for not more than ninety days or both. See § 66-8-7(B). Thus, the penalty available under Subsection D is the penalty generally assigned a misdemeanor under the Motor Vehicle Code, while the penalty available under Subsection E is "another penalty specified," which is consistent with the penalty generally assigned misdemeanors under the Criminal Code. See NMSA 1978, § 31-19-1(A) (Repl.Pamp.1990); see also NMSA 1978, § 30-1-1 (Repl.Pamp.1984).
. Compare NMSA 1978, § 66-1-4.16(Q) (Supp.1990) ("subsequent offender" defined as a person who was “previously a first offender and who again, under state law, federal law or municipal ordinance, has been adjudicated guilty of the charge of driving a motor vehicle while under the influence of intoxicating liquor”) and NMSA 1978, § 66-1-4(64) (Repl.Pamp.1989) (same) with NMSA 1978, §§ 66-5-23, -29, -35 (Repl.Pamp.1989) and NMSA 1978, § 66-8-135 (Cum.Supp.1990) (in each of which the term “subsequent offender" appears); see also NMSA 1978, § 66-1-4.6 (Supp.1990) (defining "first offender”); § 66-1-4(22) (Repl.Pamp.1989) (same).
. See 1988 N.M.Laws, ch. 56, §§ 2, 10.
. Prior to its most recent amendment, Section 66-8-102(E) provided a mandatory two-day jail term for a “second or subsequent conviction occurring within five years of a prior conviction." Id. “Subsequent offender,” however, was not defined until 1988, at which time the word "third” was substituted for “subsequent" in describing the convictions for which the two-day jail term was mandatory.