Implement better CBOR encoding