Add a function to remove duplicates from an array