switch/case changed to if/else