Grid refactoring