Update index logic