Refactor index.