Refactor2

You probably shouldn't merge this until after the game ends.

(a couple of these lingering commits might fix actual bugs though)

I'm going to (maybe) pile on some more commits tomorrow night.