Made some optimizations to the depth instrumentation phase