The grid function now working