On October 28, 2011, Kathy K. Torbert filed a petition for a declaratory ruling pursuant to Ala.Code 1975, § 41-22-ll(a), with the Alabama Department of Public Health (“ADPH”), seeking an interpretation of certain of ADPH’s rules governing solid-waste collection and transportation facilities. Specifically, Torbert sought a ruling on the application of Ala. Admin. Code (ADPH), r. 420-3-5-.12(2)(a)2., and the starting and ending point of measurement for the 500-foot buffer zone the rule requires between “the area of transfer activities or storage of garbage [in a garbage-transfer station] and the nearest residence, school or recreational park.... ” ADPH, through the State Health Officer, Dr. Donald E. Williamson, issued a declaratory ruling on Torbert’s request on December 5, 2011. Pursuant to § 41-22-11(b) and Ala.Code 1975, § 41-22-20(b) & (d), Torbert appealed ADPH’s ruling to the Montgomery Circuit Court on January 6, 2012.
As required by § 41-22-20(d), Tor-bert filed a petition for judicial review in the circuit court on February 6, 2012. In March 2012, Torbert filed a motion requesting the circuit court to remand the matter to ADPH under § 41-22-20(e) “so that a factual determination can be made as to the exact distances from various points and locations of the transfer facility and locations in the immediate surrounding area and any such other factual determinations that [ADPH] deems necessary.” ADPH opposed Torbert’s motion, arguing that Torbert’s request that the matter be remanded for factual determinations “fails to recognize [the] difference between declaratory rulings and contested case proceedings.” ADPH also argued that Tor-bert’s petition for a declaratory ruling had requested that ADPH declare “ ‘the points from which the buffer zones are to be measured to comply’ ” with the applicable rule, which request, ADPH pointed out, did not involve a factual dispute. A remand to determine factual issues, argued ADPH, would turn Torbert’s petition for a declaratory ruling into a contested case.
The circuit court entered an order on July 1, 2013, remanding the matter to ADPH. ADPH filed its petition for a writ of mandamus to this court on August 8, 2013. In its petition, ADPH argues, as it did before the circuit court, that remanding a matter on an appeal of a declaratory ruling to the agency for it to make factual determinations is not permitted and that such a remand ignores the distinction between petitions for declaratory rulings and contested cases. We deny the petition.
*652“ ‘ “[M]andamus is a drastic and extraordinary writ that will be issued only when there is: (1) a clear legal right in the petitioner to the order sought; (2) an imperative duty upon the respondent to perform, accompanied by a refusal to do so; (3) the lack of another adequate remedy; and (4) properly invoked jurisdiction of the court.” Ex parte Horton, 711 So.2d 979, 983 (Ala.1998).’ ”
Ex parte Builders & Contractors Ass’n of Mississippi Self-Insurer’s Fund, 980 So.2d 1003, 1006 (Ala.Civ.App.2007) (quoting Ex parte Alloy Wheels Int’l, Ltd., 882 So.2d 819, 821 (Ala.2003), overruled on other grounds by Ex parte DBI, Inc., 23 So.3d 635, 657 (Ala.2009)).
Although the Alabama Administrative Procedure Act (“the AAPA”), Ala.Code 1975, § 41-22-1 et seq., does not specifically define a petition for a declaratory ruling, § 41-22-11(a) addresses petitions for declaratory rulings. That section indicates that a person substantially affected by a rule may petition an agency for a declaratory ruling and that “an agency may issue a declaratory ruling with respect to the validity of the rule or with respect to the applicability to any person, property or state of facts of any rule or statute enforceable by it....” (Emphasis added.) A contested case is, however, defined in the AAPA and is “[a] proceeding, including but not restricted to ratemaking, price fixing, and licensing, in which the legal rights, duties, or privileges of a party are required by law to be determined by an agency after an opportunity for hearing.” Ala.Code 1975, § 41-22-3(3) (emphasis added). Based on the language used to describe each form of relief, contends ADPH, a declaratory ruling may be made without a hearing, while a contested case must be decided after a hearing.
According to ADPH, the distinctions between the contested-case process and the declaratory-ruling process prevent the circuit court from having the power to remand a matter to an agency on an appeal from a declaratory ruling. However, § 41-22-11(b) states clearly that declaratory “rulings are subject to review in the Circuit Court of Montgomery County, unless otherwise specifically provided by the statute, in the manner provided in Section 41-22-20 for the review of decisions in contested cases.” Nothing in the text of § 41-22-11(b) indicates that the application of § 41-22-20 is to be altered in any way when an appeal involves a declaratory ruling as opposed to a contested case. Thus, the plain language of § 41-22-ll(b) requires and permits a circuit court considering an appeal from a declaratory ruling to follow the procedure set out in § 41-22-20.
However, ADPH contends that § 41-22-20(e), the provision upon which Torbert based her motion seeking remand of the matter to ADPH, should not apply to appeals from declaratory rulings. Section 41-22-20(e) states:
“If there has been no hearing prior to agency action and the reviewing court finds that the validity of the action depends upon disputed facts, the court shall order the agency to conduct a prompt fact-finding proceeding under this chapter after having a reasonable opportunity to reconsider its determination on the record of the proceedings.”
ADPH argues that, when one considers the remainder of the AAPA in pari materia with § 41-22-20(e), see Blackmon v. Brazil, 895 So.2d 900, 907 (Ala.2004) (quoting Ex parte Berryhill, 801 So.2d 7, 10 (Ala. 2001), quoting in turn Kirkland v. State, 529 So.2d 1036, 1038 (Ala.Crim.App.1988)) (“‘“When ascertaining legislative intent, statutes which are in pari materia ... *653must be interpreted as a whole in light of the general purpose of the statute.” ’ ”), it is clear that the legislature could not have intended to allow a circuit court to remand a matter on an appeal of a declaratory ruling for a hearing to resolve factual issues when, ADPH says, the procedure for issuing a declaratory ruling does not require a fact-finding hearing. Allowing the circuit court to remand the matter for a fact-finding hearing, says ADPH, will convert Torbert’s request for a declaratory ruling into a contested case without her having followed the procedures to initiate a contested case. Instead, posits ADPH, the legislature must have intended to have the circuit court apply only § 41-22-20(1?),1 which sets out the standard of review of an agency action, to its review of declaratory rulings. We cannot agree with ADPH.
This court has made clear that “a petition for declaratory ruling is not considered a ‘contested case’ under the [AJAPA.” Alabama Ass’n of Home Health Agencies v. ABC Home Health & Hospice of Alabama, Inc., 601 So.2d 1027, 1030 (Ala.Civ. App.1992). We agree with ADPH that the several sections of the AAPA must be construed in pari materia, but we cannot conclude that construing § 41-22-11 and § 41-22-20 in pari materia results in the conclusion that ADPH desires. That is, the recognition of a distinction between the two avenues of relief available to a party who wishes to challenge an agency’s action under a particular rule does not equate with a determination that the appeal process for a declaratory ruling, which is specifically set out in § 41-22-ll(b) as being the same as the process for the appeal of a contested case under § 41-22-20, must also differ.
Although we understand the logical underpinnings of ADPH’s argument, the clear language of § 42-22-ll(b) cannot be trumped by an appeal to reason.
“It is this Court’s responsibility to give effect to the legislative intent whenever that intent is manifested. State v. Union Tank Car Co., 281 Ala. 246, 248, 201 So.2d 402, 403 (1967). When interpreting a statute, this Court must read the statute as a whole because statutory language depends on context; we will *654presume that the Legislature knew the meaning of the words it used when it enacted the statute. Ex parte Jackson, 614 So.2d 405, 406-07 (Ala.1993). Additionally, when a term is not defined in a statute, the commonly accepted definition of the term should be applied. Republic Steel Corp. v. Horn, 268 Ala. 279, 281, 105 So.2d 446, 447 (1958). Furthermore, we must give the words in a statute their plain, ordinary, and commonly understood meaning, and where plain language is used we must interpret it to mean exactly what it says. Ex parte Shelby County Health Care Auth, 850 So.2d 332 (Ala.2002).”
Bean Dredging, L.L.C. v. Alabama Dep’t of Revenue, 855 So.2d 513, 517 (Ala.2003).
Section 41-22-ll(b) states that a declaratory ruling is to be reviewed “in the manner provided in Section 41-22-20 for the review of decisions in contested cases.” Section 41-22-20(e) permits a circuit court reviewing the appeal of a contested case or declaratory ruling to remand the matter to the agency if it determines that resolution of factual questions is required to judge the validity of an agency action. Thus, based on the plain language used in the relevant statutes, the circuit court’s remand order was in compliance with § 41-22-20.
ADPH further argues that Torbert failed to raise her factual dispute before ADPH in her petition for a declaratory ruling. Thus, ADPH contends, Torbert was not permitted to raise the existence of a factual issue before the circuit court. Based on this premise, ADPH argues that the circuit court was confined by § 41-22-20(j) to considering only the administrative record in deciding Torbert’s appeal. Although § 41-22-20Q) does state that a circuit court’s review of an appeal from a contested case or a declaratory ruling is “confined to the record,” that phrase is limited by the caveat “except as herein provided.”2 In light of the power of the circuit court to remand the matter to ADPH under § 41-22-20(e), which we have determined was properly exercised in Torbert’s appeal from the declaratory ruling, we cannot agree that the circuit court was limited to considering only the administrative record.
Based on the language of § 41-22-11(b), Torbert’s appeal was governed by § 41-22-20. The circuit court’s remand of this matter was permitted under § 41-22-20(e). ADPH has not established a clear, legal right to the relief it seeks. Accordingly, we deny ADPH’s petition for the writ of mandamus.
PETITION DENIED.
THOMPSON, P.J., and PITTMAN, MOORE, and DONALDSON, JJ., concur.. As we pointed out in Alabama State Personnel Board v. Brashears, 575 So.2d 1149, 1151 (Ala.Civ.App.1991), which involved the appeal of the dismissal of a petition for a declaratory ruling, § 41-21-20(k) also permits a circuit court considering an appeal from a declaratory ruling or contested case to remand the matter to the agency for the taking of additional evidence or for other proceedings. In its entirety, § 41-22-20 reads:
"(k) Except where judicial review is by trial de novo, the agency order shall be taken as prima facie just and reasonable and the court shall not substitute its judgment for that of the agency as to the weight of the evidence on questions of fact, except where otherwise authorized by statute. The court may affirm the agency action or remand the case to the agency for taking additional testimony and evidence or for further proceedings. The court may reverse or modify the decision or grant other appropriate relief from the agency action, equitable or legal, including declaratory relief, if the court finds that the agency action is due to be set aside or modified under standards set forth in appeal or review statutes applicable to that agency or if substantial rights of the petitioner have been prejudiced because the agency action is any one or more of the following:
"(1) In violation of constitutional or statutory provisions;
“(2) In excess of the statutory authority of the agency;
"(3) In violation of any pertinent agency rule;
"(4) Made upon unlawful procedure;
"(5) Affected by other error of law;
"(6) Clearly erroneous in view of the reliable, probative, and substantial evidence on the whole record; or
"(7) Unreasonable, arbitrary, or capricious, or characterized by an abuse of discretion or a clearly unwarranted exercise of discretion.”
. Section 41-22-20(j) begins: "The review shall be conducted by the court without a jury and, except as herein provided, shall in the review of contested cases be confined to the record....”