Refactored RDD instrumentation code