semi-working version of grid sorter