Added SVM and refactored algorthim code