updated clean_pair and clean_single