metrics refactoring