adding loop for grid classes