Rearrange divs for grid