Fixed the switch statement's redundant code