Generalized ToStream and UseLazy, added stream scan.