Some optimizations in tree_classifier