diff --git a/auth/jsonfield.py b/auth/jsonfield.py
index 44574a14d973e88b0b12fde42df2c5b33d6fcfcd..ed99b57e0160bf7f08a5d184af7613d1546f17bb 100644
--- a/auth/jsonfield.py
+++ b/auth/jsonfield.py
@@ -40,7 +40,10 @@ class JSONField(models.TextField):
         if value == "" or value == None:
             return None
 
-        parsed_value = json.loads(value)
+        try:
+            parsed_value = json.loads(value)
+        except:
+            import pdb; pdb.set_trace()
 
         if self.json_type and parsed_value:
             parsed_value = self.json_type.fromJSONDict(parsed_value, **self.deserialization_params)
diff --git a/helios/crypto/elgamal.py b/helios/crypto/elgamal.py
index 8d62d6a6620e7d39f072f6e461b5e3a9c02bb107..0772f18515718e388f8fbe8a3b90905f7e9df6c5 100644
--- a/helios/crypto/elgamal.py
+++ b/helios/crypto/elgamal.py
@@ -149,7 +149,11 @@ class SecretKey:
     def __init__(self):
         self.x = None
         self.pk = None
-    
+
+    @property
+    def public_key(self):
+        return self.pk
+
     def decryption_factor(self, ciphertext):
         """
         provide the decryption factor, not yet inverted because of needed proof
diff --git a/helios/datatypes/2011/01.py b/helios/datatypes/2011/01.py
index 547c217c28d05c606594d4e618415a8eac698203..7f30ca2412d144e54a15bd81bd35deec603ef883 100644
--- a/helios/datatypes/2011/01.py
+++ b/helios/datatypes/2011/01.py
@@ -29,6 +29,9 @@ class Election(LDObject):
     'frozen_at': 'core/Timestamp'
     }
 
+class Voter(LDObject):
+    FIELDS = ['election_uuid', 'uuid', 'voter_type', 'voter_id_hash', 'name']
+
 class EncryptedAnswer(LDObject):
     FIELDS = ['choices', 'individual_proofs', 'overall_proof', 'randomness', 'answer']
     STRUCTURED_FIELDS = {
diff --git a/helios/datatypes/__init__.py b/helios/datatypes/__init__.py
index 8674a54462773108e41a654fe37ec526a82f5e24..6c2195da64456f51c7348346c612ec9673624821 100644
--- a/helios/datatypes/__init__.py
+++ b/helios/datatypes/__init__.py
@@ -118,6 +118,9 @@ class LDObject(object):
 
     @classmethod
     def instantiate(cls, obj, datatype=None):
+        if isinstance(obj, LDObject):
+            return obj
+
         if hasattr(obj, 'datatype') and not datatype:
             datatype = getattr(obj, 'datatype')
 
@@ -136,7 +139,10 @@ class LDObject(object):
 
         # go through the subfields and instantiate them too
         for subfield_name, subfield_type in dynamic_cls.STRUCTURED_FIELDS.iteritems():
-            return_obj.structured_fields[subfield_name] = cls.instantiate(getattr(return_obj.wrapped_obj, subfield_name), datatype = subfield_type)
+            try:
+                return_obj.structured_fields[subfield_name] = cls.instantiate(getattr(return_obj.wrapped_obj, subfield_name), datatype = subfield_type)
+            except:
+                import pdb; pdb.set_trace()
 
         return return_obj
 
@@ -178,7 +184,7 @@ class LDObject(object):
                 # a structured ld field, recur
                 try:
                     sub_ld_object = self.fromDict(d[f], type_hint = self.STRUCTURED_FIELDS[f])
-                except TypeError:
+                except KeyError:
                     import pdb; pdb.set_trace()
 
                 self.structured_fields[f] = sub_ld_object
diff --git a/helios/datatypes/legacy.py b/helios/datatypes/legacy.py
index e646eb41e32daefa256b2b86f1b0d000d9b2143c..e1c0dd89e118835790b949c109f0f349416eb956 100644
--- a/helios/datatypes/legacy.py
+++ b/helios/datatypes/legacy.py
@@ -109,10 +109,10 @@ class EGPublicKey(LegacyObject):
 
 class EGSecretKey(LegacyObject):
     WRAPPED_OBJ_CLASS = crypto_elgamal.SecretKey
-    FIELDS = ['x','pk']
+    FIELDS = ['x','public_key']
     STRUCTURED_FIELDS = {
         'x': 'core/BigInteger',
-        'pk': 'legacy/EGPublicKey'}
+        'public_key': 'legacy/EGPublicKey'}
 
 class EGCiphertext(LegacyObject):
     WRAPPED_OBJ_CLASS = crypto_elgamal.Ciphertext
@@ -169,7 +169,10 @@ class Result(LegacyObject):
     pass
 
 class Questions(LegacyObject):
-    pass
+    WRAPPED_OBJ = list
+
+    def __len__(self):
+        return len(self.wrapped_obj)
 
 class Tally(LegacyObject):
     pass
diff --git a/helios/datatypes/pkc/elgamal.py b/helios/datatypes/pkc/elgamal.py
index 0f0688dc45af8213c6b351873bde97216132422d..8d4e063304bd8f92b32c7bcdb028b55b509b260a 100644
--- a/helios/datatypes/pkc/elgamal.py
+++ b/helios/datatypes/pkc/elgamal.py
@@ -22,3 +22,21 @@ class PublicKey(LDObject):
         'g' : 'core/BigInteger',
         'q' : 'core/BigInteger'}
 
+
+class SecretKey(LDObject):
+    WRAPPED_OBJ_CLASS = crypto_elgamal.SecretKey
+
+    FIELDS = ['public_key', 'x']
+    STRUCTURED_FIELDS = {
+        'public_key' : 'pkc/elgamal/PublicKey',
+        'x' : 'core/BigInteger'
+        }
+
+class DLogProof(LDObject):
+    WRAPPED_OBJ_CLASS = crypto_elgamal.DLogProof
+    FIELDS = ['commitment', 'challenge', 'response']
+
+    STRUCTURED_FIELDS = {
+        'commitment' : 'core/BigInteger',
+        'challenge' : 'core/BigInteger',
+        'response' : 'core/BigInteger'}
diff --git a/helios/models.py b/helios/models.py
index 516c7af466d34338cfb2acb1d8559fa413fd223e..39d97ed58c79f0e0ae5bbb066a312c4799e2cbf3 100644
--- a/helios/models.py
+++ b/helios/models.py
@@ -409,12 +409,12 @@ class Election(HeliosModel):
     trustee.uuid = str(uuid.uuid4())
     trustee.name = settings.DEFAULT_FROM_NAME
     trustee.email = settings.DEFAULT_FROM_EMAIL
-    trustee.public_key = keypair.pk
-    trustee.secret_key = keypair.sk
+    trustee.public_key = datatypes.LDObject.instantiate(keypair.pk, 'pkc/elgamal/PublicKey')
+    trustee.secret_key = datatypes.LDObject.instantiate(keypair.sk, 'pkc/elgamal/SecretKey')
     
     # FIXME: compute it
-    trustee.public_key_hash = utils.hash_b64(utils.to_json(trustee.public_key.toJSONDict()))
-    trustee.pok = trustee.secret_key.prove_sk(algs.DLog_challenge_generator)
+    trustee.public_key_hash = utils.hash_b64(trustee.public_key.serialize())
+    trustee.pok = datatypes.LDObject.instantiate(trustee.secret_key.wrapped_obj.prove_sk(algs.DLog_challenge_generator), 'pkc/elgamal/DLogProof')
 
     trustee.save()
 
diff --git a/helios/tests.py b/helios/tests.py
index 9837271ca70ba289431bc8fc57c12e18d1eb86b8..88235accac67f558e9b74aebac5b23ab102eb419 100644
--- a/helios/tests.py
+++ b/helios/tests.py
@@ -234,7 +234,6 @@ class DatatypeTests(TestCase):
                 'g' : '2343243242',
                 'q' : '2343242343434'}, type_hint = 'pkc/elgamal/PublicKey')
         
-        import pdb; pdb.set_trace()
         
         
 
@@ -278,12 +277,12 @@ class LegacyElectionBlackboxTests(DataFormatBlackboxTests, TestCase):
     EXPECTED_TRUSTEES_FILE = 'helios/fixtures/legacy-trustees-expected.json'
     EXPECTED_BALLOTS_FILE = 'helios/fixtures/legacy-ballots-expected.json'
 
-class V3_1_ElectionBlackboxTests(DataFormatBlackboxTests, TestCase):
-    fixtures = ['v3.1-data.json']
-    EXPECTED_ELECTION_FILE = 'helios/fixtures/v3.1-election-expected.json'
-    EXPECTED_VOTERS_FILE = 'helios/fixtures/v3.1-election-voters-expected.json'
-    EXPECTED_TRUSTEES_FILE = 'helios/fixtures/v3.1-trustees-expected.json'
-    EXPECTED_BALLOTS_FILE = 'helios/fixtures/v3.1-ballots-expected.json'
+#class V3_1_ElectionBlackboxTests(DataFormatBlackboxTests, TestCase):
+#    fixtures = ['v3.1-data.json']
+#    EXPECTED_ELECTION_FILE = 'helios/fixtures/v3.1-election-expected.json'
+#    EXPECTED_VOTERS_FILE = 'helios/fixtures/v3.1-election-voters-expected.json'
+#    EXPECTED_TRUSTEES_FILE = 'helios/fixtures/v3.1-trustees-expected.json'
+#    EXPECTED_BALLOTS_FILE = 'helios/fixtures/v3.1-ballots-expected.json'
 
 ##
 ## overall operation of the system
@@ -393,7 +392,7 @@ class ElectionBlackboxTests(TestCase):
                 'csrf_token': self.client.session['csrf_token']})
 
         self.assertContains(response, "SUCCESS")
-        
+
         # freeze election
         response = self.client.post("/helios/elections/%s/freeze" % election_id, {
                 "csrf_token" : self.client.session['csrf_token']})
diff --git a/helios/views.py b/helios/views.py
index f33e17d0a536b83c312317213edd621faf4fc7c7..6fe14473b75b0da19d069051260a8380ff749d4d 100644
--- a/helios/views.py
+++ b/helios/views.py
@@ -15,7 +15,7 @@ from mimetypes import guess_type
 
 import csv, urllib
 
-from crypto import algs, electionalgs
+from crypto import algs, electionalgs, elgamal
 from crypto import utils as cryptoutils
 from helios import utils as helios_utils
 from view_utils import *
@@ -35,10 +35,7 @@ from models import *
 import forms, signals
 
 # Parameters for everything
-ELGAMAL_PARAMS = algs.ElGamal()
-#ELGAMAL_PARAMS.p = 169989719781940995935039590956086833929670733351333885026079217526937746166790934510618940073906514429409914370072173967782198129423558224854191320917329420870526887804017711055077916007496804049206725568956610515399196848621653907978580213217522397058071043503404700268425750722626265208099856407306527012763L
-#ELGAMAL_PARAMS.q = 84994859890970497967519795478043416964835366675666942513039608763468873083395467255309470036953257214704957185036086983891099064711779112427095660458664710435263443902008855527538958003748402024603362784478305257699598424310826953989290106608761198529035521751702350134212875361313132604049928203653263506381L
-#ELGAMAL_PARAMS.g = 68111451286792593845145063691659993410221812806874234365854504719057401858372594942893291581957322023471947260828209362467690671421429979048643907159864269436501403220400197614308904460547529574693875218662505553938682573554719632491024304637643868603338114042760529545510633271426088675581644231528918421974L
+ELGAMAL_PARAMS = elgamal.Cryptosystem()
 
 # trying new ones from OlivierP
 ELGAMAL_PARAMS.p = 16328632084933010002384055033805457329601614771185955389739167309086214800406465799038583634953752941675645562182498120750264980492381375579367675648771293800310370964745767014243638518442553823973482995267304044326777047662957480269391322789378384619428596446446984694306187644767462460965622580087564339212631775817895958409016676398975671266179637898557687317076177218843233150695157881061257053019133078545928983562221396313169622475509818442661047018436264806901023966236718367204710755935899013750306107738002364137917426595737403871114187750804346564731250609196846638183903982387884578266136503697493474682071L
@@ -805,7 +802,7 @@ def one_election_register(request, election):
 def one_election_save_questions(request, election):
   check_csrf(request)
   
-  election.questions = utils.from_json(request.POST['questions_json']);
+  election.questions = datatypes.LDObject.instantiate(utils.from_json(request.POST['questions_json']), 'legacy/Questions');
   election.save()
 
   # always a machine API