Refactor msg_queue_events to use an array.