optimising the tree.html