Fixed many typos in comments and docstrings.

Thanks Piotr Kasprzyk for help with the patch.