Changed dictionary to hash for faster lookup -- doesn't seem to have done much but I still haven't profiled it