Removed redundant code in residual.c