General cleanups

Start of some cleanups. I might autopep8 this eventually.