refactoring and adding more metrics