Simplify buffer handling.
Merge pull request #9 from dsymonds/patch-1

Simplify buffer handling.