Deep code refactoring