refactoring and next set of exercises