added tests and refactored the code a little
0.0.8