grid code reorganization