Changed the way the phases switch