Simplify a switch statement.