Almost done with obtaining index change for innermost loop. Should extend it to others. Logic for integrating at the right place is still missing