refactorings and another test
refactoring and fixed tests