Moved code from bstream.hpp to ibstreamn.hpp