Removed code redundancy in switch statement.