Fixed previous commit.
Replaced if statements with switch statement.