Faster version of duplicates