Added destructor that closes stream according to cascade policy.
Streamlined API and added doc comments.