Made sort work on grid