implement with buffer