Added code to compute rmsdis4