alternative deindex/reindex implementation