Clean up and format code

This PR removes trailing whitespace and mixed spaces/tabs. It also cleans up a few other minor issues causing warnings in Eclipse.