Still refactoring, looking better.
Checkpointing - first working cut of bottom-up tree generation.