refractor to use the new metric framework