Index: /branches/New Persistence Exploration/Persistence/Persistence/DeSerializer.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/DeSerializer.cs	(revision 1355)
+++ /branches/New Persistence Exploration/Persistence/Persistence/DeSerializer.cs	(revision 1356)
@@ -57,5 +57,5 @@
     }
 
-    private delegate void Handler(IParseToken token);
+    private delegate void Handler(ISerializationToken token);
 
     private readonly Dictionary<int, object> id2obj;
@@ -68,7 +68,4 @@
     private List<Thunk> finalFixes;
 
-    public DeSerializer(IEnumerable<KeyValuePair<string, int>> typeCache) : 
-      this(typeCache, PersistenceConfiguration.Instance) {}
-  
     public DeSerializer(
       IEnumerable<KeyValuePair<string, int>> typeCache,
@@ -78,9 +75,9 @@
       compositeStack = new Stack<IAccessibleObject>();
       handlers = new Dictionary<Type, Handler> {
-                     {typeof (CompositeStart), CompositeStartHandler},
-                     {typeof (CompositeEnd), CompositeEndHandler},
-                     {typeof (Primitive), PrimitiveHandler},
-                     {typeof (Reference), ReferenceHandler},
-                     {typeof (Null), NullHandler}
+                     {typeof (BeginToken), CompositeStartHandler},
+                     {typeof (EndToken), CompositeEndHandler},
+                     {typeof (PrimitiveToken), PrimitiveHandler},
+                     {typeof (ReferenceToken), ReferenceHandler},
+                     {typeof (NullReferenceToken), NullHandler}
                    };      
       typeIds = new Dictionary<int, Type>();
@@ -91,7 +88,7 @@
     }
 
-    public object DeSerialize(IEnumerable<IParseToken> tokens) {
+    public object DeSerialize(IEnumerable<ISerializationToken> tokens) {
       finalFixes = new List<Thunk>();
-      foreach (IParseToken token in tokens) {
+      foreach (ISerializationToken token in tokens) {
         handlers[token.GetType()].Invoke(token);
       }
@@ -102,8 +99,8 @@
     }
 
-    private void CompositeStartHandler(IParseToken token) {
-      CompositeStart start = (CompositeStart)token;
-      object instance;
-      Type type = typeIds[int.Parse(start.TypeId)];
+    private void CompositeStartHandler(ISerializationToken token) {
+      BeginToken start = (BeginToken)token;
+      object instance;      
+      Type type = typeIds[(int)start.TypeId];
       if (persistenceConfiguration.GetDecomposer(type) != null) {
         instance = new ParentReference();
@@ -118,7 +115,7 @@
         id2obj.Add((int)start.Id, instance);
     }
-    private void CompositeEndHandler(IParseToken token) {
-      CompositeEnd end = (CompositeEnd)token;
-      Type type = typeIds[int.Parse(end.TypeId)];
+    private void CompositeEndHandler(ISerializationToken token) {
+      EndToken end = (EndToken)token;
+      Type type = typeIds[(int)end.TypeId];
       IDecomposer decomposer = persistenceConfiguration.GetDecomposer(type);
       if (decomposer != null) {
@@ -134,17 +131,17 @@
         SetValue(end.Name, compositeObject.Obj);
       }
-    }    
-    private void PrimitiveHandler(IParseToken token) {
-      Primitive primitive = (Primitive)token;
-      Type type = typeIds[int.Parse(primitive.TypeId)];
+    }
+    private void PrimitiveHandler(ISerializationToken token) {
+      PrimitiveToken primitive = (PrimitiveToken)token;
+      Type type = typeIds[(int)primitive.TypeId];
       object value = persistenceConfiguration
         .GetFormatter(XmlFormat.Instance, type)
-        .DeSerialize(primitive.SerializedValue);
+        .DeSerialize(primitive.SerialData);
       if ( ! value.GetType().IsValueType )
         id2obj[(int)primitive.Id] = value;
       SetValue(primitive.Name, value);
     }
-    private void ReferenceHandler(IParseToken token) {
-      Reference reference = (Reference)token;
+    private void ReferenceHandler(ISerializationToken token) {
+      ReferenceToken reference = (ReferenceToken)token;
       object referredObject = id2obj[reference.Id];
       SetValue(reference.Name, id2obj[reference.Id]);
@@ -155,6 +152,6 @@
       } 
     }
-    private void NullHandler(IParseToken token) {
-      Null nil = (Null)token;
+    private void NullHandler(ISerializationToken token) {
+      NullReferenceToken nil = (NullReferenceToken)token;
       SetValue(nil.Name, null);
     }
Index: /branches/New Persistence Exploration/Persistence/Persistence/Serializer.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/Serializer.cs	(revision 1355)
+++ /branches/New Persistence Exploration/Persistence/Persistence/Serializer.cs	(revision 1356)
@@ -22,6 +22,4 @@
       }
     }
-
-    public Serializer(object obj) : this(obj, PersistenceConfiguration.Instance) {}
 
     public Serializer(object obj, PersistenceConfiguration persistenceConfiguration) :        
Index: /branches/New Persistence Exploration/Persistence/Persistence/Tokens.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/Tokens.cs	(revision 1355)
+++ /branches/New Persistence Exploration/Persistence/Persistence/Tokens.cs	(revision 1356)
@@ -2,8 +2,6 @@
 namespace Persistence {
 
-  #region Serialization Tokens
+  public interface ISerializationToken {}
 
-  public interface ISerializationToken {
-  }
   public class BeginToken : ISerializationToken {    
     public readonly string Name;
@@ -16,4 +14,5 @@
     }
   }
+
   public class EndToken : ISerializationToken {
     public readonly string Name;
@@ -26,4 +25,5 @@
     }
   }
+
   public class PrimitiveToken : ISerializationToken {
     public readonly string Name;
@@ -38,4 +38,5 @@
     }
   }
+
   public class ReferenceToken : ISerializationToken {
     public readonly string Name;
@@ -46,4 +47,5 @@
     }
   }
+
   public class NullReferenceToken : ISerializationToken {
     public readonly string Name;
@@ -52,57 +54,4 @@
     }
   }
-  #endregion
-
-  #region DeSerialization Tokens
-
-  public interface IParseToken { }
-
-  public class CompositeStart : IParseToken {
-    public readonly string Name;
-    public readonly string TypeId;
-    public readonly int? Id;
-    public CompositeStart(string name, string typeId, int? id) {
-      Name = name;
-      TypeId = typeId;
-      Id = id;
-    }
-  }
-  public class CompositeEnd : IParseToken {
-    public readonly string Name;
-    public readonly string TypeId;
-    public readonly int? Id;
-    public CompositeEnd(string name, string typeId, int? id) {
-      Name = name;
-      TypeId = typeId;
-      Id = id;
-    }
-  }
-  public class Primitive : IParseToken {
-    public readonly string Name;
-    public readonly string TypeId;
-    public readonly string SerializedValue;
-    public readonly int? Id;
-    public Primitive(string name, string typeId, string serilaizedValue, int? id) {
-      Name = name;
-      TypeId = typeId;
-      SerializedValue = serilaizedValue;
-      Id = id;
-    }
-  }
-  public class Reference : IParseToken {
-    public readonly string Name;
-    public readonly int Id;
-    public Reference(string name, int id) {
-      Name = name;
-      Id = id;
-    }
-  }
-  public class Null : IParseToken {
-    public readonly string Name;
-    public Null(string name) {
-      Name = name;
-    }
-  }
-  #endregion
 
 }
Index: /branches/New Persistence Exploration/Persistence/Persistence/XmlParser.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/XmlParser.cs	(revision 1355)
+++ /branches/New Persistence Exploration/Persistence/Persistence/XmlParser.cs	(revision 1356)
@@ -8,8 +8,8 @@
 
 
-  public class XmlParser : IEnumerable<IParseToken> {
+  public class XmlParser : IEnumerable<ISerializationToken> {
 
     private readonly XmlReader reader;
-    private delegate IEnumerator<IParseToken> Handler();
+    private delegate IEnumerator<ISerializationToken> Handler();
     private readonly Dictionary<string, Handler> handlers;
 
@@ -28,10 +28,10 @@
                    };
     }
-    public IEnumerator<IParseToken> GetEnumerator() {
+    public IEnumerator<ISerializationToken> GetEnumerator() {
       while (reader.Read()) {
         if (!reader.IsStartElement()) {
           break;
         }
-        IEnumerator<IParseToken> iterator;
+        IEnumerator<ISerializationToken> iterator;
         try {
           iterator = handlers[reader.Name].Invoke();
@@ -47,35 +47,36 @@
       }
     }
-    private IEnumerator<IParseToken> ParsePrimitive() {
+    private IEnumerator<ISerializationToken> ParsePrimitive() {
       int? id = null;
       string idString = reader.GetAttribute("id");
       if (idString != null)
         id = int.Parse(idString);
-      yield return new Primitive(
+      yield return new PrimitiveToken(
         reader.GetAttribute("name"),
-        reader.GetAttribute("typeId"),        
+        int.Parse(reader.GetAttribute("typeId")),
         reader.ReadString(),
         id);
     }
-    private IEnumerator<IParseToken> ParseComposite() {
-      string name = reader.GetAttribute("name");      
-      string typeId = reader.GetAttribute("typeId");
+    private IEnumerator<ISerializationToken> ParseComposite() {
+      string name = reader.GetAttribute("name");            
       string idString = reader.GetAttribute("id");
       int? id = null;
+      int? typeId = null;
       if (idString != null)
-        id = int.Parse(idString);      
-      yield return new CompositeStart(name, typeId, id);
-      IEnumerator<IParseToken> iterator = GetEnumerator();
+        id = int.Parse(idString);
+        typeId = int.Parse(reader.GetAttribute("typeId"));
+      yield return new BeginToken(name, typeId, id);
+      IEnumerator<ISerializationToken> iterator = GetEnumerator();
       while (iterator.MoveNext())
         yield return iterator.Current;
-      yield return new CompositeEnd(name, typeId, id);
+      yield return new EndToken(name, typeId, id);
     }
-    private IEnumerator<IParseToken> ParseReference() {
-      yield return new Reference(
+    private IEnumerator<ISerializationToken> ParseReference() {
+      yield return new ReferenceToken(
         reader.GetAttribute("name"),
         int.Parse(reader.GetAttribute("ref")));
     }
-    private IEnumerator<IParseToken> ParseNull() {
-      yield return new Null(reader.GetAttribute("name"));
+    private IEnumerator<ISerializationToken> ParseNull() {
+      yield return new NullReferenceToken(reader.GetAttribute("name"));
     }
     IEnumerator IEnumerable.GetEnumerator() {
Index: /branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs	(revision 1355)
+++ /branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs	(revision 1356)
@@ -14,5 +14,5 @@
       r.dict.Add("two", 2);
       r.dict.Add("three", 3);
-      Serializer s = new Serializer(r);        
+      Serializer s = new Serializer(r, PersistenceConfiguration.Instance);        
       Persistence.XmlFormatter xmlFormatter = new XmlFormatter();
       StreamWriter writer = new StreamWriter("test.xml");
@@ -31,5 +31,7 @@
       
       XmlParser parser = new XmlParser(new StreamReader("test.xml"));
-      DeSerializer deSerializer = new DeSerializer(XmlParser.ParseTypeCache(new StreamReader("test-types.xml")));        
+      DeSerializer deSerializer = new DeSerializer(
+        XmlParser.ParseTypeCache(new StreamReader("test-types.xml")),
+        PersistenceConfiguration.Instance);        
       object o = deSerializer.DeSerialize(parser);
       Root t = CloningFactory.DefaultClone(r);
@@ -39,5 +41,5 @@
     public static void Test2() {
       Manager m = new Manager();      
-      Serializer s = new Serializer(m);
+      Serializer s = new Serializer(m, PersistenceConfiguration.Instance);
       Persistence.XmlFormatter xmlFormatter = new XmlFormatter();
       StreamWriter writer = new StreamWriter("test2.xml");
@@ -49,5 +51,7 @@
       writer.Close();
       XmlParser parser = new XmlParser(new StreamReader("test2.xml"));
-      DeSerializer deSerializer = new DeSerializer(XmlParser.ParseTypeCache(new StreamReader("test-types.xml")));              
+      DeSerializer deSerializer = new DeSerializer(
+        XmlParser.ParseTypeCache(new StreamReader("test-types.xml")),
+        PersistenceConfiguration.Instance);              
       object o = deSerializer.DeSerialize(parser);
       Manager n = CloningFactory.DefaultClone(m);
