building node tree