added the some chnage in the grid functions