initial tests, refactoring