move some logic into render-grid