added RMS calculation