refactor index calc process