refactored the tree redraw out