new version at grids.py