reworked Rms algorithm. do not divide and SQRT in the loop. :-)