buffer api. closes #5.