Refactoring in build_classifier.