refactoring indexing