On the return of a writ of habeas corpus, the court may do any of the following—
(a) receive further evidence in support of the application for release from restraint;
(b) permit a respondent to show cause why the person should not be released from restraint;
(c) if it considers the restraint of the person is unlawful—order the person’s release or other disposition;
(d) set aside the writ;
(e) if the evidence placed before the court suggests some other person has custody of the person under restraint—order a further writ issue directed to the other person;
(f) make an order or give directions about the disposal of the proceedings, or about the person under restraint, as it considers appropriate.