AI frontend code refactoring