refactoring up to lesson 4