add test
more tests, refactor