Updated tree logic.