Refactored example