Added debug to calculate rms calculation length