Clean up code for ServiceRef