Refactor and optimize the return message target detection.
Ignore self-sent messages.