Change binary encoding to protobuf