Refactored grid layout