minor refactoring
more tests