diff --git a/COPYING b/COPYING
new file mode 100644
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,29 @@
+Copyright (c) 2006, HAppS.org
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+Neither the name of the HAppS.org; nor the names of its contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/HAppS-Data.cabal b/HAppS-Data.cabal
--- a/HAppS-Data.cabal
+++ b/HAppS-Data.cabal
@@ -1,6 +1,7 @@
 Name:               HAppS-Data
-Version:            0.9.2.1
+Version:            0.9.3
 License:            BSD3
+License-File:       COPYING
 Copyright:          2007 HAppS LLC
 Author:             HAppS LLC
 Maintainer:         AlexJacobson@HAppS.org
@@ -20,11 +21,21 @@
     .
      * Marshalling Haskell values to and from HTML forms.
 Tested-With:        GHC==6.6.1, GHC==6.8.2
-Build-Depends:      base, mtl, template-haskell, syb-with-class >= 0.4, HaXml >= 1.13 && < 1.14,
-                    HAppS-Util>=0.9.2, regex-compat, bytestring, pretty, binary, containers
 Build-Type:         Simple
-hs-source-dirs:     src
-Exposed-modules:
+Cabal-Version:      >=1.2
+
+flag base4
+
+Library
+  if flag(base4)
+    Build-Depends:    base >=4 && < 5, syb
+  else
+    Build-Depends:    base < 4
+
+  Build-Depends:      mtl, template-haskell, syb-with-class >= 0.4, HaXml >= 1.13 && < 1.14,
+                      HAppS-Util>=0.9.3, bytestring, pretty, binary, containers
+  hs-source-dirs:     src
+  Exposed-modules:
     HAppS.Data
     HAppS.Data.Default
     HAppS.Data.Default.Generic
@@ -40,14 +51,14 @@
     HAppS.Data.Proxy
     HAppS.Data.Serialize
     HAppS.Data.SerializeTH
-Other-modules:
+  Other-modules:
     HAppS.Data.HListBase
     HAppS.Data.Xml.Base
     HAppS.Data.Xml.Instances
     HAppS.Data.Xml.PrintParse
-Extensions: UndecidableInstances, OverlappingInstances, Rank2Types,
-            TemplateHaskell, FlexibleInstances, CPP, MultiParamTypeClasses,
-            FunctionalDependencies
--- Should also have ", DeriveDataTypeable" but Cabal complains
-GHC-Options: -Wall -fno-warn-orphans
+  Extensions: UndecidableInstances, OverlappingInstances, Rank2Types,
+              TemplateHaskell, FlexibleInstances, CPP, MultiParamTypeClasses,
+              FunctionalDependencies
+  -- Should also have ", DeriveDataTypeable" but Cabal complains
+  GHC-Options: -Wall -fno-warn-orphans
 
diff --git a/src/HAppS/Data/Serialize.hs b/src/HAppS/Data/Serialize.hs
--- a/src/HAppS/Data/Serialize.hs
+++ b/src/HAppS/Data/Serialize.hs
@@ -1,7 +1,7 @@
 {-# OPTIONS -fglasgow-exts -fallow-undecidable-instances -fallow-overlapping-instances #-}
 module HAppS.Data.Serialize
     ( Serialize(..), Version(..), Migrate(..), Mode(..), Contained, contain, extension,
-      safeGet, safePut, serialize, deserialize,
+      safeGet, safePut, serialize, deserialize, collectVersions,
       Object(objectType), mkObject, deserializeObject, parseObject,
       module HAppS.Data.Proxy
     ) where
@@ -111,7 +111,14 @@
 deserialize bs = case runGetState safeGet bs 0 of
                    (val, rest, _offset) -> (val, rest)
 
-
+-- Version lookups
+collectVersions :: forall a . (Typeable a, Version a) => Proxy a -> [L.ByteString]
+collectVersions proxy
+    = case mode :: Mode a of
+        Primitive                          -> [thisType]
+        Versioned _ Nothing                -> [thisType]
+        Versioned _ (Just (Previous prev)) -> thisType : (collectVersions prev)
+    where thisType = (L.pack . show . typeOf . unProxy) proxy
 
 --------------------------------------------------------------
 -- Instances
diff --git a/src/HAppS/Data/Xml/Base.hs b/src/HAppS/Data/Xml/Base.hs
--- a/src/HAppS/Data/Xml/Base.hs
+++ b/src/HAppS/Data/Xml/Base.hs
@@ -275,6 +275,7 @@
           res = case readConstr resType $ first toUpper n of
                 Just c -> f c
                 Nothing -> if endsWithNum n then readElement r (Elem (noNum n) es) else Nothing
+          f :: Constr -> Maybe t
           f c =     let m :: m ([Element], t)
                         m = constrFromElements r c es
                     in case r of
