Replaced a switch with a HashMap.