refactor, more tests