Reorganizing grid output