Formatting and indentation fixes

* Converted everything to use 4 spaces for indentation
* Removed trailing whitespace
* Ensured a newline at EOF
* Removed unnecessary parentheses
* Added missing semicolons