Shared buffer

Implement a shared buffer pattern, closing #2.