buffer idea refactoring