refactoring dimGrid.tcl