adding more tests, refactoring