Subtree function

Extract a subtree