added encoding of message