created a new function for refactoring.