Code cleanup + add unit tests
Merge pull request #3 from cyrille-leclerc/master

Code cleanup + add unit tests