now using residual vectors