Added metrics calculation