refactor index calc base