refactoring, more tests, working on to-dos