code clean up in display_tree