Use a dictionary for the upper bound rather than a load of conditionals