added check for non-repeated elements in array