working out bugs in subtree method