grid functions tested and working