applied license
fix for issue 2 plus tests

wow tests!