the tests. closes #1
refactoring for testability