It's a whole pile of changes.

Please review my commits. If anything is unclear, let me know. Also, there are cleanups later on in the history for some things that I might have made messy in the intermediate. Sorry about that.

Let me know what you think :)