use smart pointers for streams