Changed location of the switch statement.