added maingrid parse code