Use golint to improve style, add comments, fixes #9, fixes #2