Replaced the condensed if statements with a switch statement.