added teacher switch algoritme