made a cull_duplicates function