Ran gofmt on the entire codebase and made the code more readable in a few places.

__Note:__ I've signed the CLA.