Fix default metric name and some refactoring