Makes my brain hurt, but I think this will only run through the loop one time looking at the last element of the array.