Refactor library structure to match go workspace pattern

I added most of the code you got in the main.go into unittests.
You can run those using go test

please merge this to fix #1 

If you are not maintaining this repository anymore please let me know.