Added metric calculation