refactor UpdateIndices