If to switch

Replaces if statements with switch cases.