Added calculation of coefficients