add more tests, end refactor