New implementation for buffer and stream