Replace each with index with built in version indexing