"Generic" implementation of streams.