Improve grid.isValidPoint()