Replace if statements with switch/case