polished the grid class and integrated