refactored code, exercise complete