Up until tree construction

Needs refactoring