refactoring + new tests
adding docs