one additional test and lots of refactoring
more refactoring