Apply a giant code cleanup.

Essentially:

- Remove unused code.

- Make it 'go vet' clean. The only remaining warnings are in generated code.

- Make it 'golint' clean. The only remaining warnings are in gerenated code.

- Smoothed out same minor things.

@juliusv  Despite the huge delta of this PR, it should be very straightforward.
FIxed in next commit.