adding functions to save and retrieve messages