updated grid definitions and cleaned main()