Exclude dupes and optimize a little for #81