Add writer buffers and better error checking