some grid sort stuff