Split out de-/indexing, and update indexes in replacement