Refactored into modular service