Metricupgrade-- Merging SaadMufti's changes with master

I merged Saad's changes with master, made it compile. I also code reviewed it, looks good to me