pairs_in_array modified