Improved menu script for grids