changes to save model as it trains