used to fit the model