rm_duplicate is checked and cleaned up (there was a problem with
copy.deepcopy which is solved now)