changing from many if statements to switch cases