Changed is else statements to switch statement