implementing 2D grid