Fix whitespace and typos

I removed trailing whitespace and fixed some typos.

This pull request is a preparation step: by merging differences on whitespace and comments first, only meaningful differences will appear when merging the next pull requests from my fork.