Improving metrics calculation