add tests
refactor