Fixed #40. Implemented NSUndoManager that records the changes made during the retraining face and if it does not retrain, changes are not stored.