Using Metrics for Refactoring