Metrics refactoring