fixed possible race condition when streams are being reused + fixed compatibility issue with resetting the shared_ptr + added comments on implementation of new features