Replace if/else chain with a single switch statement
Replace if/else chain with a single switch statement

Replacing the `if/else` chain with a single `switch` statement makes the code just a little more idiomatic.

Also ordered the variable declarations and `case` statements so they are all in the order of priority used by this function.

Last change is not specifically initializing the booleans to `false`. `false` is already the zero value of a `bool` so unless explicitely set to `true`, they will be `false`.

kniren/gota