Updated build function to return pointer to injected service.