rearrange cells for flow