added docs about side-effects of the implementation
more tests.