Removed some unnecessary code from switch.