Implement BinaryDict for fast serialization