new grid logic