improve choose root node
refactor & fixes