index refactor