More refactoring: Move the metrics to its own package.