Shared buffer

Implement a shared buffer pattern, closes #2.