Renamed index to oldIndex