simplify buffer.go implementation