Fixed the size of the "g_pending" array (was way too large) + removed "g_state" array.