Replace huge if/else with HashMap