Sort of working svm classifier, refactor most code