refactor, add tests
refactor, add tests