Use a switch statement instead of a bunch of ifs

I think a `switch` statement is easier to read than a bunch of `if`s. What do you think?