realized a slightly nicer way to use the tree abstraction