working find_duplicates function