Pass the original index in the array into the function