switch changed to if