recitified code for calculating sim2 and added code to calculate mmr md