Added removeDuplicatesFromArray function