minor changes, the tree_test function doesnt need to explicitly indicate the end of input any more