Some go fixes

Cleaned up the code per Go standards and made a few fixes; explanations in the commit messages.