added a bunch of tests & refined implementation
0.0.2