removes duplicate values in array using unique function