Updated version: refactored service and controller.