v2: more succint way of creating tree. v3: testing edges as each subtree is made