changed index3 to index to update