Move metric to configuration, clean up and add sanity checks