Updating the index to be the correct index