
258 Kan. 708 (1995)
STATE OF KANSAS, Appellant,
v.
JOSE PONCE, Appellee.
No. 72,871
Supreme Court of Kansas.
Opinion filed December 8, 1995.
R. Douglas Sebelius, county attorney, argued the cause, and Carla J. Stovall, attorney general, was with him on the brief for appellant.
Elizabeth Seale Cateforis, assistant appellate defender, argued the cause, and Rebecca E. Woodman, assistant appellate defender, and Jessica R. Kunen, chief appellate defender, were on the brief for appellee.
The opinion of the court was delivered by
McFARLAND, C.J.:
Jose Ponce was charged in Count I with possession of marijuana and in Count II with trafficking in contraband in a correctional institution (K.S.A. 1994 Supp. 21-3826), with the marijuana being the contraband. The district court, on motion of defendant, held K.S.A. 1994 Supp. 21-3826 was a constitutionally impermissible delegation of legislative authority and dismissed Count II. The State appeals therefrom pursuant to K.S.A. 1994 Supp. 22-3602.
We shall first determine the jurisdictional issue raised by defendant. He asserts that this court lacks jurisdiction by virtue of the district court having dismissed the appeal herein. The following is a chronological listing of the pertinent dates:
1994
September 26 Defendant files motion to dismiss Count II on ground that the statute defining the offense is constitutionally impermissible.
*709
    October 3     Motion heard and granted.
    October 10    Journal entry of October 3 action filed.
    October 11    State files: (1) its notice of appeal from dismissal of
                  Count II and (2) motion to dismiss Count I by virtue of the
                  appeal having been filed.
    October 12    Defendant files a demand for speedy trial on Count I.
    October 20    Order of dismissal (dated October 19) filed herein, stating
                  "the matter is hereby dismissed pursuant to plaintiff's
                  request." The order referred to the matter before the court
                  as being "plaintiff's motion to dismiss."
    October 31    State files its docketing statement.
    November 4    Show cause order issued by this court on the basis that we
                  lacked jurisdiction as Count I was pending.
    November 10   Journal entry of dismissal, dated October 11, filed
                  specifically spelling out that Count I is dismissed without
                  prejudice on motion of State.
Defendant argues that the order of dismissal filed October 20 dismissed the entire action, including the appeal, by using the language "the matter is hereby dismissed." This is a tortured construction. That same order begins with the statement that the above "matter comes on for hearing on the plaintiff's motion to dismiss." That motion sought dismissal only of Count I to clear the way for the appeal of Count II to proceed. We conclude that we have jurisdiction to hear this appeal.
We turn now to the single narrow issue before us on the merits. Did the district court err in dismissing Count II on the ground that K.S.A. 1994 Supp. 21-3826 is a constitutionally impermissible delegation of legislative authority? A challenge to the constitutionality of a statute is a question of law. Our scope of review is, accordingly, unlimited. See State v. Donlay, 253 Kan. 132, 133-34, 853 P.2d 680 (1993).
A statute is presumed constitutional, and all doubts must be resolved in favor of its validity. If there is any reasonable way to *710 construe a statute as constitutionally valid, the court must do so. A statute must clearly violate the constitution before it may be struck down. See Sedlak v. Dick, 256 Kan. 779, 793, 887 P.2d 1119 (1995); Chiles v. State, 254 Kan. 888, 897, 869 P.2d 707, cert. denied 130 L.Ed.2d 88 (1994); Boatright v. Kansas Racing Comm'n, 251 Kan. 240, 243, 834 P.2d 368 (1992).
K.S.A. 1994 Supp. 21-3826 provides:
"(a) Traffic in contraband in a correctional institution is introducing or attempting to introduce into or upon the grounds of any correctional institution or taking, sending, attempting to take or attempting to send from any correctional institution or any unauthorized possession while in any correctional institution or distributing within any correctional institution, any item without the consent of the administrator of the correctional institution.
"(b) For purposes of this section, `correctional institution' means any state correctional institution or facility, conservation camp, state security hospital, state youth center, community correction center or facility for detention or confinement, juvenile detention facility or jail.
"(c) Traffic in contraband in a correctional institution is a severity level 6, nonperson felony."
Prior to 1992, K.S.A. 21-3826 specified what items were contraband, and the crime was limited to those items unless consent had been given. The statute provided:
"Traffic in contraband in a penal institution is introducing or attempting to introduce into or upon the grounds of any institution under the supervision and control of the director of penal institutions or any jail, or taking, sending, attempting to take or attempting to send therefrom or any unauthorized possession while in aforesaid institution or distributing within any aforesaid institution, any narcotic, synthetic narcotic, drug, stimulant, sleeping pill, barbiturate, nasal inhaler, alcoholic liquor, intoxicating beverage, firearm, ammunition, gun powder, weapon, hypodermic needle, hypodermic syringe, currency, coin, communication, or writing without the consent of the warden, superintendent or jailer.
"Traffic in contraband in a penal institution is a class E felony."
In 1993, the statute was amended to change "penal institution" to "correctional institution."
Defendant contends that the district court correctly held that when the legislature scrapped the prior laundry list of contraband items in favor of making all items contraband unless consent was obtained by the administrator, the legislature was improperly delegating *711 its authority to define offenses. Defendant argues that the separation of powers doctrine has been violated.
Article 2, § 1 of the Kansas Constitution provides: "The legislative power of this state shall be vested in a house of representatives and senate." The Kansas Constitution creates three distinct and separate departments: the legislative, the executive, and the judicial. State v. Latham & York, 190 Kan. 411, 422, 375 P.2d 788 (1962), cert. denied 373 U.S. 919 (1963). The legislature alone has the power to define offenses and affix punishment. Courts are empowered only to ascertain whether an offense has been committed and, if so, to assess punishment. 190 Kan. at 422; see State v. Crawford, 104 Kan. 141, 143, 177 Pac. 360 (1919). However, this principle has been somewhat relaxed. Legislation enacted to punish as misdemeanors or otherwise to penalize the breach of rules promulgated by some subordinate official body created by the legislature has been allowed. 104 Kan. at 143.
The basic meaning of the separation of powers doctrine is that the whole power of one department should not be exercised by the same hands which possess the whole power of either of the other departments. Generally, while neither the federal nor Kansas constitution speaks directly to the doctrine of separation of powers, it has been recognized that the very structure of the federal and state systems of government gives rise to the doctrine. State v. Greenlee, 228 Kan. 712, 715, 620 P.2d 1132 (1980) (citing Dreyer v. Illinois, 187 U.S. 71, 47 L.Ed. 79, 23 S.Ct. 28 [1902]; Van Sickle v. Shanahan, 212 Kan. 426, 511 P.2d 223 [1973] [tracing the historical development of the doctrine]; 16 Am.Jur.2d, Constitutional Law § 277 et seq.).
It does not necessarily flow that an entire and complete separation is either desirable or was ever intended by the framers of the constitution. One department may overlap onto another. Although early decisions insisted on complete separation, later decisions have allowed a certain degree of blending or admixture of the three powers. An absolute separation of powers is impossible. Greenlee, 228 Kan. at 715-16 (citing Nixon v. Administrator of General Services, 433 U.S. 425, 53 L.Ed.2d 867, 97 S.Ct. 2777 [1977]; Leek v. Theis, 217 Kan. 784, 539 P.2d 304 [1975]).
*712 Generally, case law addressing the separation of powers doctrine involves one of two subdivisions: (a) the unlawful delegation of legislative authority to another branch of government and (b) the usurpation of the powers of one branch by another branch. Illustrative thereof are Kaufman v. Kansas Dept. of SRS, 248 Kan. 951, 811 P.2d 876 (1991), and Greenlee, 228 Kan. 712.
As previously noted, the only issue herein involves a claim of unlawful delegation of legislative authority. This type of violation occurs when there is an unlawful delegation of legislative authority to another branch of the government without sufficient standards to guide such authority. See, e.g., State ex rel. Tomasic v. City of Kansas City, 237 Kan. 572, 701 P.2d 1314 (1985); State, ex rel., v. Mermis, 187 Kan. 611, 358 P.2d 936 (1961); State, ex rel., v. Hines, 163 Kan. 300, 182 P.2d 865 (1947).
In Kaufman, 248 Kan. at 956-57, we held:
"Legislative authority may be delegated to an administrative body where guidelines are set forth in the statute that establish the manner and circumstances of the exercise of such power. Where the legislature enacts general provisions for regulation and grants a particular state agency the discretion to fill in the details, [the appellate court] will not strike down the legislation as constitutionally impermissible unless such provisions fail to fix reasonable and definite standards to govern the exercise of such authority. U.S.D. No. 279 v. Secretary of Kansas Department of Human Resources, 247 Kan. 519, Syl. ¶ 6, 802 P.2d 516 (1990).
"Standards to guide an administrative agency in the application of a statute may be inferred from the statutory purpose. Less detailed standards and guidance to administrative agencies are required in order to facilitate the administration of laws in the areas of complex social and economic problems. Vakas v. Kansas Bd. of Healing Arts, 248 Kan. 589, Syl. ¶¶ 7, 8, 808 P.2d 1355 (1991)."
In testing a statute for adequacy of standards, the character of the administrative agency is important. What is a sufficient standard must necessarily vary somewhat according to the complexity of the areas sought to be regulated. The modern trend, which this court ascribes to, is to require less detailed standards and guidance to the administrative agencies in order to facilitate the administration of laws in areas of complex social and economic problems. Guardian Title Co. v. Bell, 248 Kan. 146, 154, 805 P.2d 33 (1991). Great leeway should be allowed the legislature in setting such standards. *713 Tomasic, 237 Kan. at 585-86 (citing State ex rel., v. Bennett, 222 Kan. 12, 21, 564 P.2d 1281 [1977].
The State contends that the statute, by prohibiting any item without the consent of the administrator, has provided sufficient guidelines and therefore should be found constitutional. On the other hand, defendant argues that by eliminating the laundry list of prohibited items, the legislature has set the stage for an arbitrary exercise of authority by the institution's administrator. The 1993 amendment to the statute is not as complete a departure from the prior law as defendant argues. Under the prior law any item specifically designated as contraband could be decriminalized if consent to have the item was obtained from the warden, superintendent, or jailer. We note also that the prior law listed "communication or writing" as contraband  two categories which obviously would need some definitional rules and regulations. The opportunity for the arbitrary exercise of authority which concerns defendant was present under the prior law.
Obviously, the administrator of a correctional facility has a legitimate interest in items coming into, possessed within, or leaving the facility. The security of the facility, the safety of its employees, and the health of the inmates require appropriate control of such items. There are obvious problems with limiting contraband to a laundry list of items. Many items freely sold and generally considered innocuous in the hands of the general public can be dangerous in the hand of inmates of correctional facilities. Inmates have long exercised great ingenuity in creating new and dangerous uses for ordinary items. A meaningful laundry list would be massive in length and never complete.
In Chapter 75 of the Kansas statutes, specifically K.S.A. 75-5201 et seq., the legislature provides standards for administration of correctional facilities. It is also there that the legislature has provided the standards for the authority delegated via K.S.A. 1994 Supp. 21-3826.
K.S.A. 1994 Supp. 75-5210 sets out the guidelines for the treatment of inmates, disciplinary rules and regulations, and other activities within correctional institutions. Specifically, persons committed to the institutional care of the Secretary of Corrections are *714 to be dealt with humanely, with efforts directed toward their rehabilitation and return to the community. K.S.A. 1994 Supp. 75-5210(a). The Secretary is authorized to adopt rules and regulations for the maintenance of good order and discipline in correctional institutions, including procedures for dealing with violations. K.S.A. 1994 Supp. 75-5210(f). These rules and regulations are made available to inmates and/or published pursuant to K.S.A. 77-415 et seq. K.S.A. 1994 Supp. 75-5210(g).
The Secretary is authorized to appoint a warden of each of the correctional institutions under his or her supervision and control. K.S.A. 1994 Supp. 75-5246(a). The Secretary has the power and the duty to examine and to inquire into all matters connected with the government and discipline of the correctional institutions under his or her control, including the punishment of the inmates confined therein. The Secretary may require wardens to provide reports and to exhibit all writings pertaining to discipline within the correctional institutions. The Secretary is to adopt rules and regulations for the direction and government of the correctional institutions and may change the same from time to time. K.S.A. 1994 Supp. 75-5251.
Finally, the warden of each correctional institution may issue orders, subject to the provisions of law and the rules and regulations adopted by the Secretary, as the warden may deem necessary for the government of the correctional institution and the enforcement of discipline therein. K.S.A. 1994 Supp. 75-5256(a). All such rules and regulations and the enforcement of discipline within the correctional institution shall be published and made available to all inmates. These orders, rules, and regulations are effective until rescinded or amended by the warden or until disapproved by the Secretary. K.S.A. 1994 Supp. 75-5256(b).
Given the size and complexity of the Department of Corrections, this delegation of authority by the legislature, with these standards, is sufficient to overcome a constitutional challenge based on the separation of powers doctrine. In the above statutory scheme, authority has been delegated to the Secretary, who has the duty and responsibility to oversee the orders, rules, and regulations promulgated and published by the administrators of each correctional *715 facility. The rules and regulations are to be promulgated for the government of the institution and the discipline of the inmates. Inmates are to be treated humanely. The Secretary can disapprove any of the orders, rules, and regulations promulgated by the administrators.
Defendant cites People v. Lepik, 629 P.2d 1080 (Colo. 1981), in support of his position. Lepik, a security guard at the prison, was accused of bringing a pair of pliers into the prison in violation of the statute forbidding the introduction of contraband into a detention facility. "Contraband" was defined as "any article or thing not referred to in [the first-degree introduction statute] which a person confined in a detention facility is prohibited from obtaining or possessing by statute or a rule, regulation, or order lawfully issued by the administrative head of the detention facility." 629 P.2d at 1081 n. 1.
Lepik challenged the statute as an unlawful delegation of legislative authority because it lacked adequate legislative standards to guide the administrative discretion. Both the trial court and the appellate court agreed and found the statute unconstitutional. In doing so, the Lepik court did not object to the delegation of the rule making, per se, but rather the court believed that the legislature did not provide adequate standards to guide such rule making. Although the State pointed to both the statutory language and to a legislative declaration of purposes for the reorganization of the state department of institutions as adequate standards, the Lepik court found neither of these applicable nor adequate. 629 P.2d at 1082-83.
Although the facts and the statute in Lepik are similar to those before the court here, that case is distinguishable. Here, the legislature has provided additional guidance not provided or noted in the Colorado case. In Kansas, both the Secretary of Corrections and the wardens of state correctional institutions have been given the authority to promulgate orders, rules, and regulations promoting good order and discipline in correctional institutions. K.S.A. 1994 Supp. 75-5210; K.S.A. 1994 Supp. 75-5251. These orders, rules, and regulations are made available to inmates and published pursuant to statutory procedures. K.S.A. 1994 Supp. 75-5210; *716 K.S.A. 1994 Supp. 75-5256. These are the standards not available to the administrator in Lepik. See Annot., Conveying Contraband to Prisoner, 64 A.L.R.4th 902, 918-20.
The federal statute that defines the comparable federal crime, 18 U.S.C. § 1791 (1994), is very similar to the present Kansas statute and has withstood various constitutional challenges based upon the separation of powers doctrine. See, e.g., Carter v. United States, 333 F.2d 354 (10th Cir.1964).
The legislature could have provided more in the way of standards in the statute than it did, but the failure to do so is not a fatal defect. We conclude K.S.A. 1994 Supp. 21-3826 is not a constitutionally impermissible delegation of legislative authority.
Defendant seeks to assert an additional ground on appeal for holding the statute to be in violation of the separation of powers doctrine. The new argument is that by giving the administrator the power to consent rather than the Secretary of Corrections, the legislature has usurped the authority of the Secretary.
A legal theory not presented to the trial court may not be raised for the first time on appeal. Sharp v. State, 245 Kan. 749, 753, 783 P.2d 343 (1989), cert. denied 498 U.S. 822 (1990). However, in view of our summary of the pertinent sections of Chapter 75 relative to the respective duties of the Secretary and the wardens of the facilities and the former's control over the latter, defendant has lost nothing by not having this new theory before us.
The judgment of the district court is reversed, and the matter is remanded for further proceedings.
