AI-generated code refactoring