Rearrange v_stream so it can be included as a lib