Added code for model training and saving training data. Bugfixes with feature extraction algorithms