Implement message writer.

should this flush?