modified the algorithm comparing two different gestures to rms difference