some cleaning up the code and rms is now working