refactored for exercise #4