add the ability to detach streams, plus tests and docs