Adding functions for working with the message queue.