Started on the residual computation math