commit before bringing a lot of model fitting functions over from fossil-branches