Add support for changing streams dynamically

Fixes #4.

Also cleaned a number of things up.