Minor fixes

Typos, documentation improvements and minor refactoring.

Please merge this pull request to your repository before commiting your changes.

I'll review the tests tomorrow.