Creating dynamic grid layout without gaps.