eliminating a lot of uses of to-list in favor of a fold over the trees themselves