Updated the code for message system