refactored + modified example