minor refactoring of index