Use switch instead of if else