Bug fixed, all the levels of children for the comparison factors are well remove
Added code of last commit in a function