Fixed a while loop bug, now it can display a tree for multiple runs. Not very clean