refactoring the instrumentation part