Improved buffering logic