Eliminate unnecessary code to average Ri values