Add recursive tree builder