Refactored service logic