switched to average residual sum of squares