Tree build implemented