change the switch into if else