more tests + refactoring
more tests + refactoring