mmetrics code MA thesis