#243 metrics module, refactor