Various small cleanups

A variety of small cleanups, though they kind of come together to make something larger. But the commit messages should explain things, I hope.