Changed if/else/if/else... to switch statement

`break` in the last case/default is fine; it's more consistent this way anyway.