Buffer refactoring