Refactored reindex method