Rework index logic structure