Duplicated Code Exercise Refactored