Some reorganization to be able to write unit tests
Add unit test + travis setup
Fixed problems of pull request #22