Enhance the trees implementation on parent handling