Add functionality to retrieve messages