changes to get the index and use that for replacing