Merge pull request #624 from arik-so/encode_and_send_msg_method_refactor