Initial refactoring to fix problems created by moving growing trees to separate module.