Updated service to improve the message detection and error handling.