Fixed a whole bunch of errors after my hash->Map find and replace

And a little bit of general code cleanup too.