Finishing tree model. No compile. Needs adaptation to SQL.