Refactored the service detection instrumentation