Rewrite tree using node (draft)