Move stream to own module

Also stop using in-tree serialize