update callbacks so it works when they don't exist
let chunks and messages share buffer
optimize new message buffer creation
update comments and no more unneeded copying output bytes