Adding documentation and fixing some stuff based on golint's recommendations.