Metrics refactor