Added some more flexibility to setPhase()