A number of fixes and cleanup

I'd prefer these to stay in the main file unless there's a reason to break them out. I like the main library file to tell you something about how to use that library. Plus, it keeps small libraries simple.