
766 N.W.2d 542 (2009)
2009 WI 46
In the Matter of the John DOE petition:
State of Wisconsin ex rel. Ira B. Robins, Petitioner-Petitioner,
v.
The Honorable Patrick J. Madden, presiding, Respondent.
No. 2007AP1526-W.
Supreme Court of Wisconsin.
Argued January 6, 2009.
Decided June 11, 2009.
*543 For the petitioner-petitioner there were briefs by Joseph F. Owens and Arthur & Owens, S.C., New Berlin, and oral argument by Joseph F. Owens.
For the respondent the cause was argued by David C. Rice, assistant attorney general, with whom on the brief was J.B. Van Hollen, attorney general.
*544 ¶ 1 MICHAEL J. GABLEMAN, J.
This is a review of an unpublished opinion and order of the court of appeals denying a petition for a supervisory writ of mandamus.[1] Ira Robins ("Robins") sought the writ to compel the Circuit Court for Taylor County, Patrick J. Madden, Judge, to examine all the witnesses produced by Robins at a John Doe hearing under Wis. Stat. § 968.26 (2007-08).[2] The court of appeals concluded that § 968.26 does not require the circuit judge to examine all the witnesses produced by a John Doe complainant.[3] It therefore denied the petition for a writ of mandamus because Judge Madden had no plain legal duty to examine all the witnesses Robins produced. Robins then sought review before this court.
¶ 2 The issue we address today is whether the judge in a John Doe hearing is required under Wis. Stat. § 968.26 to examine all the witnesses a complainant produces and to issue subpoenas to all the witnesses a complainant wishes to produce. We read the statute as extending judicial discretion in a John Doe hearing not only to the scope of a witness's examination, but also to whether a witness need testify at all. Accordingly, we hold that a judge is not required by § 968.26 to examine all the witnesses a complainant produces at a John Doe hearing, or to subpoena all the witnesses a complainant wishes to produce. Robins has no clear legal right to have each of the witnesses he produced examined, and his petition for a writ of mandamus must therefore fail. Because the court of appeals examined the relevant facts, applied the proper standard of law, and used a rational process to reach a rational result, the court of appeals did not erroneously exercise its discretion in denying Robins' writ of mandamus.

I. FACTS AND PROCEDURAL HISTORY
¶ 3 On May 16, 2007, Robins submitted a petition for the initiation of a John Doe proceeding to the Circuit Court for Taylor County. The complaint detailed multiple instances of alleged criminal conduct by the Taylor County District Attorney, Karl Kelz ("Kelz"), involving a wide variety of purported misconduct in public office and criminal defamation. Robins requested in his complaint that: (1) venue of the John Doe hearing be changed to any county in which Kelz had not previously practiced law and to which criminal cases from Taylor County are not often transferred; (2) the court appoint a special prosecutor to participate in the hearing; (3) the proceedings remain open to the public; and (4) Kelz have no contact with the witnesses listed in the complaint. Taylor County Circuit Judge Gary L. Carlson then recused himself, and the matter was transferred by judicial assignment to the Honorable Patrick J. Madden of the Circuit Court for Iron County.
¶ 4 On June 6, 2007, Judge Madden convened the John Doe hearing. Robins brought five witnesses with him to the hearing to testify regarding the allegations, and had two other witnesses on-call and available for a telephonic examination. At the commencement of the hearing, Judge Madden announced that the proceeding would be secret. He ordered all *545 non-court personnelbesides Robins and his attorneyto leave the courtroom, including the five witnesses Robins had produced. Robins' attorney was ordered not to argue points of law or participate in the presentation of Robins' testimony during the hearing. Judge Madden then examined Robins under oath for more than two hours regarding the allegations in the complaint. As part of this examination, Judge Madden elicited a summary of the substance of each prospective witness's testimony.
¶ 5 After the examination, Judge Madden concluded:
The court does not have a substantial basis in fact to find that any crime in violation of 942.01 or 946.12 or any other of the statutes which the court would consider based on these facts has been violated to the point where this would meet the threshold test of a probable cause hearing, and for that reason, this petition is dismissed.
Five days thereafter, on June 11, Judge Madden issued an order dismissing the petition[4] on the grounds that there were "insufficient facts to warrant a criminal prosecution."[5]
¶ 6 On July 5, 2007, Robins petitioned the court of appeals for a supervisory writ of mandamus to compel Judge Madden to: (1) reconvene the John Doe proceeding; (2) examine all witnesses produced by Robins regarding the allegations in the complaint; (3) appoint a special prosecutor; and (4) issue a final written decision that includes findings of fact and conclusions of law.
¶ 7 After receiving Judge Madden's response, the court of appeals issued an opinion and order on January 4, 2008, concluding that the trial court was not required to examine each witness under Wis. Stat. § 968.26. Rather, the provision requiring examination of the complainant's witnesses was to be understood in the context of the provision granting the judge discretion over the extent of the examination. After determining that Judge Madden did not refuse to perform a plain legal duty, the court of appeals denied Robins' petition for a writ of mandamus.[6]
¶ 8 Robins now appeals the denial of his petition. Upon granting review, we directed the parties to also address the closely related question of whether a judge has discretion over the issuance of subpoenas to witnesses the complainant wishes to produce.

II. STANDARD OF REVIEW
¶ 9 This case involves our review of the court of appeals' denial of a petition for a writ of mandamus. We review the court of appeals decision for erroneous exercise of discretion. Watton v. Hegerty, 2008 WI 74, ¶ 6, 311 Wis.2d 52, 751 N.W.2d 369. We will sustain a court's exercise of discretion if the court: (1) examined the relevant facts; (2) applied a proper standard *546 of law; and (3) using a demonstrably rational process, reached a conclusion that a reasonable judge could reach. Loy v. Bunderson, 107 Wis.2d 400, 414-15, 320 N.W.2d 175 (1982).
¶ 10 "Mandamus is an `extraordinary writ' that may be employed to compel public officers to perform a duty that they are legally obligated to perform." Watton, 311 Wis.2d 52, ¶ 7, 751 N.W.2d 369 (citing State ex rel. Greer v. Stahowiak, 2005 WI App 219, ¶ 7, 287 Wis.2d 795, 706 N.W.2d 161). For a writ of mandamus to issue, the petitioner for the writ must establish that: (1) he possesses a clear legal right to the relief sought; (2) the duty he seeks to enforce is positive and plain; (3) he will be substantially damaged by nonperformance of such duty; and (4) there is no other adequate remedy at law. Law Enforcement Standards Bd. v. Vill. of Lyndon Station, 101 Wis.2d 472, 493, 305 N.W.2d 89 (1981).
¶ 11 The determination of whether Judge Madden refused to perform a plain legal duty depends on whether there is in fact a duty under Wis. Stat. § 968.26 to examine all witnesses a complainant produces at a John Doe hearing. We interpret statutes independently, but benefit from the analysis of previous court decisions. Watton, 311 Wis.2d 52, ¶ 6, 751 N.W.2d 369.

III. ANALYSIS

A. Statutory Interpretation Generally
¶ 12 The present case involves interpretation and clarification of the John Doe proceedings outlined in Wis. Stat. § 968.26. "[T]he purpose of statutory interpretation is to determine what the statute means so that it may be given its full, proper, and intended effect." State ex rel. Kalal v. Circuit Court for Dane County, 2004 WI 58, ¶ 44, 271 Wis.2d 633, 681 N.W.2d 110. Our analysis "`begins with the language of the statute.'" Id., ¶ 45 (quoting Seider v. O'Connell, 2000 WI 76, ¶ 43, 236 Wis.2d 211, 612 N.W.2d 659). "[S]tatutory language is interpreted in the context in which it is used; not in isolation but as part of a whole; in relation to the language of surrounding or closely-related statutes; and reasonably, to avoid absurd or unreasonable results." Id., ¶ 46. We strive where possible "to give reasonable effect to every word, in order to avoid surplusage." Id.

B. John Doe Proceedings Generally
¶ 13 John Doe proceedings, which have been around since Wisconsin's territorial days, have two purposes. First, they are an investigative tool designed to allow the judge to determine whether a crime has been committed, and if so, who committed it. State ex rel. Reimann v. Circuit Court for Dane County, 214 Wis.2d 605, 621, 571 N.W.2d 385 (1997). Second, they exist to protect innocent people from frivolous and groundless prosecutions. Id.
¶ 14 Wisconsin Stat. § 968.26 outlines a four-step process for John Doe proceedings.[7] First, the judge must determine *547 whether a complainant has alleged "objective, factual assertions sufficient to support a reasonable belief that a crime has been committed." Reimann, 214 Wis.2d at 623, 571 N.W.2d 385.
¶ 15 If the petitioner's complaint supports a reason to believe that a crime has been committed, then the judge must proceed with a hearing at which "the judge shall examine the complainant under oath and any witnesses produced by him or her." Wis. Stat. § 968.26. We have previously concluded that this provision requires the judge to examine the complainant. Reimann, 214 Wis.2d at 615, 571 N.W.2d 385 ("[W]e conclude that once a John Doe complainant has shown that he or she has reason to believe a crime has been committed, the judge has no discretion to refuse to examine the complainant."). Today we address the statute's applicability to witnesses the complainant proffers.[8] Critical to our analysis here is the statute's declaration that "[t]he extent to which the judge may proceed in the examination is within the judge's discretion." Wis. Stat. § 968.26.
¶ 16 At the close of the hearing, the judge must determine whether "it appears probable from the testimony given that a crime has been committed and who committed it." Id. This means a judge must determine whether probable cause exists as to each essential element of the alleged crime. See State v. Watson, 227 Wis.2d 167, 205, 595 N.W.2d 403 (1999). The judge makes his or her probable cause determination by assessing only the plausibility of a witness's testimony, not the credibility or trustworthiness of the witness. See Wilson v. State, 59 Wis.2d 269, 294, 208 N.W.2d 134 (1973).
¶ 17 Finally, if the judge determines that probable cause is presentthat is, that a crime probably has been committedand who the perpetrator of the alleged crime is, the judge may order that a criminal complaint be reduced to writing and (if so ordered) that a warrant issue for the arrest of the accused. Wis. Stat. § 968.26. A John Doe judge has broad discretion to decide whether to file a criminal complaint, even upon a finding of probable cause.[9]


*548 C. Must a Judge Examine All Witnesses a John Doe Complainant Produces?
¶ 18 This case requires us to make sense of a statute that is not a model of clarity. On the one hand, Wis. Stat. § 968.26 provides that "the judge shall examine the complainant under oath and any witnesses produced by him or her." (Emphasis added.) On its own, this provision manifestly requires that "any witnesses produced" "shall" be examined. But the statute also provides a significant qualifier: "The extent to which the judge may proceed in the examination is within the judge's discretion." Id. The question, then, is whether this statute requires a judge to examine all witnesses produced by the complainant, or whether the judge's discretion over the scope of the examination includes the authority to decide which witnesses will be heard.
¶ 19 Robins contends that once a judge determines the complaint supports a reason to believe a crime has been committed, the judge is required to examine not only the complainant, but also all witnesses produced by the complainant at the hearing. The statute's use of the word "shall," according to Robins, is both straightforward and unalterable. He maintains that this mandatory examination clause stands on its own, and therefore must be interpreted independently of the judicial discretion clause. While the judge retains considerable discretion under Robins' approach, that discretion applies only to the scope of each witness's examination, not to which witnesses will be called. While Robins acknowledges that this interpretation may lead to some inefficiencies, he insists the statute is clear.
¶ 20 Judge Madden, on the other hand, argues that though examination of the complainant is required, examination of witnesses must be viewed in the context of the judicial discretion clause. To see it otherwise, Judge Madden asserts, opens the court up to all manner of abuses. Judges, for example, would be required to call an irrelevant but nevertheless produced witness, only to ask the witness nothing of substance. Judge Madden maintains that this formalistic interpretation would force judges to waste considerable time and resources by requiring them to call irrelevant and repetitive witnesses. Thus, the only reasonable way to interpret the statute, according to Judge Madden, is to view the discretion clause as controlling the whole examination. The only person who must be examined if the "reason to believe" standard is met is the complainant.
¶ 21 Our interpretation of this passage is ultimately guided by our obligation to view the text as a whole, and in particular with a view to avoiding absurd or unreasonable results. See Kalal, 271 Wis.2d 633, ¶ 46, 681 N.W.2d 110. Requiring John Doe judges to examine all produced witnesses makes no sense. Such a requirement does not comport with: (1) the general principles of judicial oversight and discretion; (2) the purpose of a John Doe hearing; and (3) leads to absurd and unreasonable results. Therefore, Robins' interpretation must be rejected.
¶ 22 As we have previously noted, "[t]he John Doe judge is a judicial officer who serves an essentially judicial function." State v. Washington, 83 Wis.2d 808, 823, 266 N.W.2d 597 (1978). A John Doe judge has authority to "issue subpoenas, examine witnesses, adjourn the proceedings, take possession of subpoenaed records, adjudicate probable cause, and issue and seal warrants." In re John Doe Proceeding, 2003 WI 30, ¶ 54, 260 Wis.2d 653, *549 660 N.W.2d 260. As to all aspects of the conduct of the judicial function, the judge is the governor of the proceedings, and as such is responsible for maintaining the good order, dignity, and insofar as it is compatible with the administration of justice, efficiency of those proceedings. See id., ¶¶ 52-54 (discussing the broad powers of a John Doe judge to oversee the hearing and exercise the authority inherent in the judicial office).
¶ 23 The goal of a John Doe hearing is to allow the judge to determine whether "it appears probable from the testimony given that a crime has been committed and who committed it," and then whether to file a complaint. See Wis. Stat. § 968.26. The whole of the hearing must be seen in this light. See Washington, 83 Wis.2d at 823, 266 N.W.2d 597 ("The John Doe judge should act with a view toward issuing a complaint or determining that no crime has occurred."). As we have previously said, the John Doe hearing is primarily an investigative device, the scope of which "is essentially limited to the subject matter of the complaint." Id. at 822, 266 N.W.2d 597. The John Doe judge has a mandate, and he or she is to exercise his or her discretion toward this end. Requiring the judge to call all produced witnesses to the stand, without regard to the competence, relevance, or repetitive nature of the witness's testimony, does not advance this goal.
¶ 24 Robins' interpretation calls forth the specter of absurdities that are as numerous as they are wasteful. Under his approach, a complainant could produce all of his neighborsbe they fellow residents of a tree-lined neighborhood or fellow inmates of a prison cell blockand require the judge to clear the court's calendar for however many hours or days it might take to call and perfunctorily examine each witness.[10] Similarly, Robins' approach means the John Doe judge would have discretion over non-produced witnesses and over witnesses the complainant wishes to subpoena, but not over witnesses brought to the hearing. Such a distinction makes little sense. Or, if, for example, after the testimony of only one or two witnesses, the John Doe judge determined that probable cause exists, the judge would still be required to examine all of the remaining witnesses the complainant produced (if the complainant does not wish to excuse them). See id. at 824, 266 N.W.2d 597 (noting that when the facts make clear that a person is probably guilty of an offense, it would not be proper to continue the John Doe hearing).
¶ 25 Such an approach removes control of the courtroom from the hands of the judge and places it into the hands of the John Doe complainant. This cannot be squared in any way with either common sense or the statute's language that the judge retains discretion over the extent of the examination. This approach would divorce the examination from the goal of the proceedings and waste the time of the complainant, the court, and the witnesses themselves.
¶ 26 Just as it is unreasonable to force a judge to call all witnesses once an affirmative probable cause determination has been made, it is equally unreasonable to force a judge to examine all witnesses once a determination has been made that probable cause does not exist. We see no danger in allowing a judge to determine prior to examination that the produced witness or witnesses are not competent to testify, *550 do not have relevant testimony, have testimony that is cumulative or repetitive, or any other such factors making examination of the witness inappropriate or unnecessary. The John Doe judge may accomplish this in a variety of ways, including eliciting an offer of proof from the complainant as was essentially done here, receiving brief written witness summaries from the complainant, a combination of oral and written offers of proof, or some similar procedure reasonably calculated to allow the judge to exercise his or her discretion with regard to the testimony he or she will hear.
¶ 27 A judge is to oversee a John Doe hearing in such a way as "to ensure that the proceeding is conducted in an orderly and expeditious manner." Id. The only way the judge can do this is to limit not only the scope of an individual witness's examination, but also which witnesses may testify. Wisconsin Stat. § 968.26 cannot be reasonably interpreted otherwise. John Doe judges must not be shackled to a process that frustrates the goal of ascertaining probable cause in an expeditious manner. The statute, then, is susceptible to but one reasonable construction: Wis. Stat. § 968.26 when read as a whole preserves the circuit court's discretion as to which witnesses it will examine in a John Doe proceeding.

D. Must a Judge Subpoena All Witnesses a John Doe Complainant Wishes to Produce?
¶ 28 In response to our request, the parties addressed the question of whether a John Doe judge must issue subpoenas for all witnesses a complainant wishes to produce. Both parties agree that a judge retains discretionary authority as to the issuance of such subpoenas. We conclude that a John Doe judge need not issue subpoenas for every witness a complainant wishes to produce. Those same factors which lead us to conclude a John Doe judge need not examine each witness produced by a complainant compel a symmetrical result as to the issuance of subpoenas. Indeed, it would be even more wasteful to compel a John Doe judge to issue subpoenas for incompetent, cumulative, unnecessary, or irrelevant witnesses than it would be to force the judge to examine them.

IV. CONCLUSION
¶ 29 The issue we address today is whether the judge in a John Doe hearing is required under Wis. Stat. § 968.26 to examine all the witnesses a complainant produces and to issue subpoenas to all the witnesses a complainant wishes to produce. We read the statute as extending judicial discretion in a John Doe hearing not only to the scope of a witness's examination, but also to whether a witness need testify at all. Accordingly, we hold that a judge is not required by § 968.26 to examine all the witnesses a complainant produces in a John Doe hearing, or to subpoena all the witnesses a complainant wishes to produce. Robins has no clear legal right to have each of the witnesses he produced examined, and his petition for a writ of mandamus must therefore fail. Because the court of appeals examined the relevant facts, applied the proper standard of law, and used a rational process to reach a rational result, the court of appeals did not erroneously exercise its discretion in denying Robins' writ of mandamus.
The opinion and order of the court of appeals is affirmed.
SHIRLEY S. ABRHAMSON, C.J., did not participate.
NOTES
[1]  State ex rel. Robins v. Madden, No. 2007AP1526-W, unpublished order (Wis.Ct. App. Jan. 4, 2008).
[2]  All subsequent references to the Wisconsin Statutes are to the 2007-08 version unless otherwise indicated.
[3]  The "complainant" is the person who complains to the judge because he or she believes a crime has been committed. Robins is the complainant in the case at bar.
[4]  Pursuant to his authority under the statute, Judge Madden also ordered "that the file be sealed, and the proceedings remain secret." See Wis. Stat. § 968.26 ("The examination ... may be secret.").
[5]  Robins contends that Judge Madden used the wrong legal standard in dismissing his petition. Judge Madden admits that his written order did not accurately reflect the standard, but argues that he applied the proper legal standard at the hearing when he orally concluded that Robins had not presented sufficient facts that "would meet the threshold test of a probable cause hearing." We are satisfied that Judge Madden applied the proper standard as evidenced by his oral ruling and do not reexamine the question here.
[6]  The court of appeals did not address the request to compel Judge Madden to appoint a special prosecutor because it denied Robins' petition. For the same reason, we also decline to address this question.
[7]  The statute provides in pertinent part:

If a person complains to a judge that he or she has reason to believe that a crime has been committed within his or her jurisdiction, the judge shall examine the complainant under oath and any witnesses produced by him or her and may, and at the request of the district attorney shall, subpoena and examine other witnesses to ascertain whether a crime has been committed and by whom committed. The extent to which the judge may proceed in the examination is within the judge's discretion.... If it appears probable from the testimony given that a crime has been committed and who committed it, the complaint may be reduced to writing and signed and verified; and thereupon a warrant shall issue for the arrest of the accused.
[8]  It is true that certain passages in the Reimann opinion seem to implicate the question before us today. The opinion states, for example: "The plain language of Wis. Stat. § 968.26 requires a judge to examine a John Doe complainant and his or her witnesses, if any, when the complainant has reason to believe a crime has been committed within that judge's jurisdiction." State ex rel. Reimann v. Circuit Court for Dane County, 214 Wis.2d 605, 614, 571 N.W.2d 385 (1997).

The facts of that case make clear, however, that the court was not addressing witness examinations in a John Doe hearing. In Reimann, a John Doe complainant's petition was denied without a hearing or any examination of the complainant. We held that if the reasonable belief threshold requirement is satisfied, then and only then are the statute's mandatory hearing/examination provisions triggered. See id. at 615, 571 N.W.2d 385. Thus, although the issue in Reimann was broadly framed, we concluded that "once a John Doe complainant has shown that he or she has reason to believe that a crime has been committed, the judge has no discretion to refuse to examine the complainant." Id.
We affirm Reimann's holding that once the threshold requirement is met, the judge must examine the complainant. However, in order to avoid any confusion, we withdraw the language in Reimann which appears to require a John Doe judge to examine all witnesses produced by a complainant. We recognize that this language was set forward in a context different from that which we address today.
[9]  Previously, the statute required a judge to issue a criminal complaint upon a finding of probable cause. However, the legislature amended Wis. Stat. § 968.26 in 1991. Prior to this amendment, the statute stated that a complaint "shall be reduced to writing," and now states that it "may be reduced to writing." See 1991 Wis. Act 88, § 1.
[10]  As Robins concedes, his approach would force a judge to call all extraneous witnesses produced by the complainant, have them state their names, and simply excuse them from the stand.
