Refactored code, instrumenting loop only if all loop header components have been identified.