(a) If, during the pendency of a criminal charge and prior to the time when jeopardy would attach in the case of an adult, the court with criminal jurisdiction determines that:
(1) the case was initially brought before the court with criminal jurisdiction and the defendant was under 18 years of age at the time of the alleged offense; or
(2) the case was improperly transferred to the court with criminal jurisdiction by the Family Division of the court due to a mistake as to the age of the child,
the court with criminal jurisdiction shall forthwith transfer the case, together with all the papers, documents, and testimony connected therewith, to the Family Division of the court. When making such transfer, the court shall order said child to be taken forthwith to the place of detention designated by the Family Division of the court or to the court itself, or shall release such child to the custody of some suitable person, or a public or private agency to be brought before the Family Division of the court at a time designated.(b) If, during the pendency of a criminal charge and after the time when jeopardy would attach in the case of an adult, the court determines that:
(1) the case was initially brought before the court with criminal jurisdiction and the defendant was under 18 years of age at the time of the alleged offense; or
(2) the case was improperly transferred to the court with criminal jurisdiction by the Family Division of the court due to a mistake as to the age of the child,
the court with criminal jurisdiction, with good cause shown, may elect to:(A) retain jurisdiction and
(i) dismiss the action; or
(ii) proceed with the trial; or
(B) upon consent of the child, transfer the matter to the Family Division of the court as described in subsection (a) of this section.