Make buffers into something struct-like, with appropriate support functions