Fixes

Well, there's a whole bunch of changes in there. I don't know if you'll like them all, but I'm opening this pull request to show that I've implemented some things that were in the TODO.