Global code refactoring