refactoring
tests written