Simplify switch statement