let chunks and messages share buffer
optimize new message buffer creation
update comments and no more unneeded copying output bytes