cleaned up SVM code