Changed residual calc