Refactor metrics