more tests & refactorings