More work on tree generation