More work on JS stream code