Simplified UpdateGrid() logic.
Indented code based on Visual Studio Reformat Document settings.