Added type to fit_model function