Refined grid naming and refactored code