added some functions for the grid.