metrics refactor