Use refcounted buffers for IO.

Need to use buffers multiple times when broadcasting.
Merge pull request #6 from fancycode/refcount_buffers

Use refcounted buffers for IO.