Cleaned up the g_pMain reference.