working with duplicate array