Added message control to break out of loop is all messages had been atte...

...mpted and switched the sleep order.