Refactored for challenge 6