global code refactoring