adding save.data to model fitting functions; other clean-up