Grid logic