Refactoring switch/case for readability.