refactoring calculator