small refactoring of challenge 7