Restructure code, making it more consistent with original order, but protecting against null reference.
Restructure code, making it more consistent with original order, but protecting against null reference.

MapWindow/MapWinGIS,MapWindow/MapWinGIS,MapWindow/MapWinGIS,MapWindow/MapWinGIS,MapWindow/MapWinGIS