generalize remove_cp