First semi-working version of tree pair composition

Still need to make doctests work though.