Redesigned streams: they are no longer templates.
Added scan functions.