Optimized minimal tree finder.