more tests and refactoring