implemented _rebuildIndex