adding residuals