Implementing message encoding.