changing index logic