A few improvements

Hi @willmorgan, here are a few improvements I've made.

Sorry they are all bunched up - I consider them fairly minor, and they are all backwards compatible.

Happy to split up into separate pull requests, if needed.
oh yeah, this too