code break down for grid for ipad and iphone