Added print_tree as well as tests.