Implemented automatic refactoring