Refactors an if/else clause to switch/case