General cleanup

I forgot to branch this off master, and so the commits from the previous PR are also showing up here. I didn't want those commits to get merged without review, so I'm sending the new ones (they don't need a review I think) as a PR as well.