improve remove_duplicates. add UI