Add build tree and print tree method