completed mode switching implementation