If the court finds in favor of the applicant, it shall vacate and set aside the judgment and sentence and discharge or resentence him, or grant a new trial, or correct or modify the judgment and sentence as may appear appropriate. The court shall enter any supplementary orders as to rearraignment, retrial, custody, bail, discharge, or other matters that may be necessary and proper.
Okla. Stat. tit. 22, § 1085