Rework the send_message method and add debug messages