make maxgridsize a object variable