Remove unused nodes from node tree.