Use an immutable map rather than the worst if statement in the world.  (This commit should be squashed into the previous one).