changing swithc to if