Move buffering logic to an abstract base class