Fixes and changes in the grid logic