frameowrk for main tree mining fn [ci skip]