Construct array comparisons correctly