few small modifications and refinements to trees