Fixed an intermittent bug that occurred on shutdown as a result of inconsistent cleanup order (sometimes g_pMain's destructor was not being called, so we ensure that's done first by moving the instance into the scope of main()). As an added bonus, the global's name actually makes sense again.
Essential debug information is now generated for release builds.