Changes to remove duplicates method