starting to refactor, write test