Thanks to @treyhunner and Loïc for their suggestions and review. Backport of 72d3889db4 from master
72d3889db4
* Removed trailing whitespace. * Added newline to EOF if missing. * Removed blank lines at EOF. * Removed some stray tabs.