Refactored switch statements