rewrite tree conversion function to return subtrees instead of modify in place

seems a little clearer/cleaner to me