Fix formatting

* Remove trailing whitespaces
* Use spaces for indentation consistently
* Make sure every file ends with a newline character