
173 P.3d 652 (2007)
STATE of Kansas, Appellee,
v.
Nathan T. MOSES, Appellant.
No. 96,897.
Court of Appeals of Kansas.
December 21, 2007.
*653 Ryan Eddinger, of Kansas Appellate Defender Office, for appellant.
Ann L. Smith, assistant county attorney, Charles Branson, county attorney, and Paul J. Morrison, attorney general, for appellee.
Before CAPLINGER, P.J., ELLIOTT and LEBEN, JJ.
CAPLINGER, P.J.
Nathan Moses appeals his convictions of forgery and misdemeanor possession of marijuana, alleging the district court erred in trying him based upon stipulated facts contained in a revoked diversion agreement. He *654 asserts the diversion agreement was invalid because it failed to specifically include a waiver of his right to a preliminary examination as required by K.S.A. 22-2909(a).
We agree that the diversion agreement's omission of a waiver of the defendant's right to a preliminary hearing rendered the agreement invalid. Thus, the district court erred in trying Moses based on stipulated facts contained in the agreement, and we reverse and remand this case to the district court so that Moses may be placed in the same position he would have been in absent the diversion agreement.
Factual and procedural background
The State charged Moses with forgery, a severity level 8, nonperson felony, in violation of K.S.A.2003 Supp. 21-3710(a)(1) and possession of marijuana in violation of K.S.A. 65-4162(a)(3). The parties entered into a diversion agreement, which was revoked after Moses failed to comply with its terms. Moses filed a motion to dismiss, which the district court denied. Following a bench trial based upon stipulated facts contained in the diversion agreement, the district court found Moses guilty of both charges.
Moses appeals his conviction arguing the district court erred in relying upon the stipulated facts in the diversion agreement. Moses contends the agreement was invalid and unenforceable because it lacked a waiver of his right to a preliminary hearing, as required by K.S.A. 22-2909(a). The State argues the diversion agreement, if read in its entirety, included the statutory requirements, and the district court appropriately relied upon the stipulated facts in trying Moses.
Standard of review
Whether the diversion agreement complied with the requirements of K.S.A. 22-2909(a) is a question of law to be decided upon uncontroverted facts; hence, our review is plenary and unlimited. See Petty v. City of El Dorado, 270 Kan. 847, 850, 19 P.3d 167 (2001).
Compliance with K.S.A. 22-2909(a)
K.S.A. 22-2909(a) states in relevant part: "The diversion agreement shall include specifically the waiver of all rights under the law or the constitution of Kansas or of the United States to a speedy arraignment, preliminary examinations and hearings, and a speedy trial."
The diversion agreement at issue here specifically included a waiver of "all rights to a speedy trial as they exist under the statutes and constitutions of the State of Kansas and the United States" and a waiver of "all rights to a trial by jury." Moses argues, however, that the agreement did not include a waiver of Moses' right to a preliminary examination, specific or otherwise.
The State points out that in addition to Moses' specific waiver of "all rights to a speedy trial" and "all rights to a trial by jury," Moses acknowledged his right to "a prompt, full and complete evidentiary hearing and trial in this matter." The State suggests that this acknowledgment, when read in conjunction with the specific waivers, satisfies the requirements of K.S.A. 22-2909(a).
The language relied upon by the State arguably supports Moses' interpretation of the agreement; i.e., Moses acknowledged his right to a full and complete evidentiary hearing, yet he waived only his rights to a speedy trial and trial by jury. Moses' specific waiver of certain rights while failing to waive others lends credibility to his argument that he intended to preserve his right to a preliminary examination, not waive it.
At best, the State suggests Moses implicitly, rather than explicitly, waived the right to a preliminary examination. Yet the unambiguous language of K.S.A. 22-2909(a) does not permit us to make such a finding. The statute provides that the diversion agreement "shall" include "specifically" a waiver of the right to preliminary examinations and hearings.
Nor are we willing to interpret the term "shall" in K.S.A. 22-2909(a) as directory rather than mandatory.
*655 "Shall" is generally defined as "imperative or mandatory," but it "may be construed as merely permissive or directory (as equivalent to `may'), to carry out the legislative intention." Black's Law Dictionary 1375 (6th ed.1990). In considering whether a legislative provision was mandatory or directory, the Kansas Supreme Court in State v. Deavers, 252 Kan. 149, 167, 843 P.2d 695 (1992), cert denied 508 U.S. 978, 113 S.Ct. 2979, 125 L.Ed.2d 676 (1993), stated:
[I]t is a general rule that where strict compliance with the provision is essential to the preservation of the rights of parties affected and to the validity of the proceeding, the provision is mandatory, but where the provision fixes a mode of proceeding and a time within which an official act is to be done, and is intended to secure order, system, and dispatch of the public business, the provision is directory. Factors which would indicate that the provisions of a statute or ordinance are mandatory are: (1) the presence of negative words requiring that an act shall be done in no other manner or at no other time than that designated, or (2) a provision for a penalty or other consequence of noncompliance."
Two cases illustrate the application of this principle. In State v. Bryant, 37 Kan.App.2d 924, 163 P.3d 325 (2007), the court determined that the statutory provision requiring the district court to hold a hearing to establish restitution before imposing a sentence was directory rather than mandatory. The court relied upon the fact that the hearing was "not essential to the preservation of the rights of the parties," but instead "fixes a mode of proceeding and a time within which an official act may be accomplished." 37 Kan.App.2d at 930-31, 163 P.3d 325.
In contrast, in Barnhart v. Kansas Dept. of Revenue, 243 Kan. 209, 210, 755 P.2d 1337 (1988), the Kansas Supreme Court determined the statutory provision requiring the giving of oral and written notice of statutory rights before the administering of blood alcohol level tests was mandatory rather than directory. 243 Kan. at 212-13, 755 P.2d 1337. The court noted that the statute specifically required certain procedures and notices be given to the individual arrested for driving under the influence. Further, absent proper notice, the use of blood alcohol tests was prohibited by the statute. 243 Kan. at 212-13, 755 P.2d 1337.
While K.S.A. 22-2909(a) lacks negative language and does not specify a penalty or other consequence for noncompliance, strict compliance with the provision is essential to the preservation of the rights of parties affected. The requirement that the defendant specifically waive certain rights is not simply a technical or procedural requirement, but a condition required for the formation of an enforceable diversion agreement. Accordingly, the term "shall" as used in K.S.A. 22-2909(a) is mandatory rather than directory.
Because the diversion agreement did not contain a specific waiver of Moses' right to a preliminary hearing, as mandated by K.S.A. 22-2909(a), we conclude the agreement was invalid and unenforceable.
Effect of failure to comply with statutory requirements of K.S.A. 22-2909(a)
Moses argues that if the diversion agreement was invalid, we must remand the case to the district court so that Moses can be retried, placing him in the same position he would have been in absent the diversion agreement. The State has not addressed the effect of a failure to comply with K.S.A. 22-2909(a). Further, the State conceded in oral argument that if the agreement was invalid, remand is required.
Although we are aware of no case directly addressing the issue of the effect of a failure to comply with the statutory provisions of K.S.A. 22-2909(a), the Kansas Supreme Court has considered whether the inclusion of an invalid jail time provision in a diversion agreement invalidated the entire agreement. E.g. Petty v. City of El Dorado, 270 Kan. 847, 853-54, 19 P.3d 167 (2001). Reasoning that "it is the duty of the courts to sustain the legality of contracts in whole or in part when possible," the court struck the invalid condition and upheld the remainder of the diversion agreement. 270 Kan. at 854, 19 P.3d 167; see also State v. Scheuerman, 32 Kan. App.2d 208, 211-12, 82 P.3d 515, rev. denied *656 276 Kan. 973 (2003) (condition in diversion agreement requiring defendant to plead guilty to one charge in exchange for diversion on another charge was not statutorily prohibited; even if provision was prohibited, court noted it would strike invalid provision and uphold remainder of agreement).
This case is distinguishable from Petty, however, as it concerns the omission of a statutorily required waiver as opposed to the inclusion of an invalid, severable condition. Under these circumstances, we conclude the diversion agreement was invalid. Therefore, the district court erred in trying Moses based upon the stipulated facts contained in the agreement.
Moses' convictions are reversed, and the case is remanded to the district court so that Moses may be placed in the same position he would have been in absent the diversion agreement.
Reversed and remanded.
