added support for saving training data