Updated the code a bit to make the message extraction logic a bit clearer.