Add buffer function. Fixes #55.