implement support for writing messages