Buffer class refactoring