finished SVM refactoring