Refactored alert service.