Changed readmessages from a forever for loop to just a function that
returns the message and error. Up to the application to check it