finally working buffer