now the computation of the fitting is done here