more refactoring for challenge 6