Cleanup, conform to Go standards better. Tests implemented.
Merge conflict