modified to test on grid