changed if statements to a switch