refactoring&tests