Refactoring: Replaced 2 Switch statements with HashMaps