refactor metrics