Implement message writer.

where does 16 come from/