Implementing simple stream cloning

Fixes #416