Switched if/else logic to switch/case syntax