added tests
refactor