better handling of duplicates