WIP: buffer refactoring