Whitespace and CS fixing, phase 1.
Update after Hannes' review.
Merged pull request #307