Further improvements to tree generation.