add new tests, refactoring