diff --git a/Data/IntMultiSet.hs b/Data/IntMultiSet.hs
--- a/Data/IntMultiSet.hs
+++ b/Data/IntMultiSet.hs
@@ -1,3 +1,7 @@
+{-# LANGUAGE CPP #-}
+#if __GLASGOW_HASKELL__
+{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-}
+#endif
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Data.IntMultiSet
@@ -129,10 +133,10 @@
 import Prelude hiding (filter,foldr,null,map,concatMap)
 import Data.Monoid (Monoid(..))
 import Data.Typeable ()
-import Data.IntMap (IntMap)
+import Data.IntMap.Strict (IntMap)
 import Data.IntSet (IntSet)
 import Data.MultiSet (MultiSet)
-import qualified Data.IntMap as Map
+import qualified Data.IntMap.Strict as Map
 import qualified Data.IntSet as Set
 import qualified Data.List as List
 import qualified Data.MultiSet as MultiSet
@@ -320,31 +324,18 @@
 
 -- | /O(log n)/. Delete the minimal element.
 deleteMin :: IntMultiSet -> IntMultiSet
--- TODO: IntMap has a different updateMin
---deleteMin = MS . Map.updateMin (deleteN 1) . unMS
-deleteMin (MS m) = case Map.minView m of
-                      Nothing     -> empty
-                      Just (1,m') -> MS m'
-                      Just (_,m') -> MS $ Map.updateMin pred m'
+deleteMin = MS . Map.updateMin (deleteN 1) . unMS
 
 -- | /O(log n)/. Delete the maximal element.
 deleteMax :: IntMultiSet -> IntMultiSet
---deleteMax = MS . Map.updateMax (deleteN 1) . unMS
-deleteMax (MS m) = case Map.maxView m of
-                      Nothing     -> empty
-                      Just (1,m') -> MS m'
-                      Just (_,m') -> MS $ Map.updateMax pred m'
+deleteMax = MS . Map.updateMax (deleteN 1) . unMS
 
 -- | /O(log n)/. Delete all occurences of the minimal element.
 deleteMinAll :: IntMultiSet -> IntMultiSet
--- TODO IntMap's deleteMin will error on empty maps!
-deleteMinAll m | null m = m
 deleteMinAll m = MS . Map.deleteMin . unMS $ m
 
 -- | /O(log n)/. Delete all occurences of the maximal element.
 deleteMaxAll :: IntMultiSet -> IntMultiSet
--- TODO IntMap's deleteMax will error on empty maps!
-deleteMaxAll m | null m = m
 deleteMaxAll m = MS . Map.deleteMax . unMS $ m
 
 -- | /O(log n)/. Delete and find the minimal element.
@@ -468,7 +459,7 @@
 
 -- | /O(n)/. Apply a function to each element, and take the union of the results
 concatMap :: (Key -> [Key]) -> IntMultiSet -> IntMultiSet
-concatMap f = fromOccurList . Map.foldWithKey mapF [] . unMS
+concatMap f = fromOccurList . Map.foldrWithKey mapF [] . unMS
   where mapF x occ rest = List.map (\y -> (y,occ)) (f x) ++ rest
 
 -- | /O(n)/. Apply a function to each element, and take the union of the results
@@ -498,13 +489,13 @@
 
 -- | /O(t)/. Post-order fold.
 foldr :: (Key -> b -> b) -> b -> IntMultiSet -> b
-foldr f z = Map.foldWithKey repF z . unMS
+foldr f z = Map.foldrWithKey repF z . unMS
  where repF a 1 b = f a b
        repF a n b = repF a (n - 1) (f a b)
 
 -- | /O(n)/. Fold over the elements of a multiset with their occurences.
 foldOccur :: (Key -> Occur -> b -> b) -> b -> IntMultiSet -> b
-foldOccur f z = Map.foldWithKey f z . unMS
+foldOccur f z = Map.foldrWithKey f z . unMS
 
 {--------------------------------------------------------------------
   List variations 
diff --git a/Data/MultiSet.hs b/Data/MultiSet.hs
--- a/Data/MultiSet.hs
+++ b/Data/MultiSet.hs
@@ -1,3 +1,7 @@
+{-# LANGUAGE CPP #-}
+#if __GLASGOW_HASKELL__
+{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-}
+#endif
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Data.MultiSet
@@ -136,9 +140,9 @@
 import Data.Monoid (Monoid(..))
 import Data.Typeable ()
 import qualified Data.Foldable as Foldable (Foldable(foldr))
-import Data.Map (Map)
+import Data.Map.Strict (Map)
 import Data.Set (Set)
-import qualified Data.Map as Map
+import qualified Data.Map.Strict as Map
 import qualified Data.Set as Set
 import qualified Data.List as List
 
@@ -248,7 +252,7 @@
 
 -- | /O(log n)/. Insert an element in a multiset.
 insert :: Ord a => a -> MultiSet a -> MultiSet a
-insert x = MS . Map.insertWith' (+) x 1 . unMS
+insert x = MS . Map.insertWith (+) x 1 . unMS
 
 -- | /O(log n)/. Insert an element in a multiset a given number of times.
 --
@@ -257,7 +261,7 @@
 insertMany x n
  | n <  0    = MS . Map.update (deleteN (negate n)) x . unMS
  | n == 0    = id
- | otherwise = MS . Map.insertWith' (+) x n . unMS
+ | otherwise = MS . Map.insertWith (+) x n . unMS
 
 -- | /O(log n)/. Delete a single element from a multiset.
 delete :: Ord a => a -> MultiSet a -> MultiSet a
@@ -449,7 +453,7 @@
 
 -- | /O(n)/. Apply a function to each element, and take the union of the results
 concatMap :: (Ord a, Ord b) => (a -> [b]) -> MultiSet a -> MultiSet b
-concatMap f = fromOccurList . Map.foldWithKey mapF [] . unMS
+concatMap f = fromOccurList . Map.foldrWithKey mapF [] . unMS
   where mapF x occ rest = List.map (\y -> (y,occ)) (f x) ++ rest
 
 -- | /O(n)/. Apply a function to each element, and take the union of the results
@@ -479,13 +483,13 @@
 
 -- | /O(t)/. Post-order fold.
 foldr :: (a -> b -> b) -> b -> MultiSet a -> b
-foldr f z = Map.foldWithKey repF z . unMS
+foldr f z = Map.foldrWithKey repF z . unMS
  where repF a 1 b = f a b
        repF a n b = repF a (n - 1) (f a b)
 
 -- | /O(n)/. Fold over the elements of a multiset with their occurences.
 foldOccur :: (a -> Occur -> b -> b) -> b -> MultiSet a -> b
-foldOccur f z = Map.foldWithKey f z . unMS
+foldOccur f z = Map.foldrWithKey f z . unMS
 
 {--------------------------------------------------------------------
   List variations 
diff --git a/include/Typeable.h b/include/Typeable.h
--- a/include/Typeable.h
+++ b/include/Typeable.h
@@ -3,52 +3,40 @@
 //
 // INSTANCE_TYPEABLEn(tc,tcname,"tc") defines
 //
-//	instance Typeable/n/ tc
-//	instance Typeable a => Typeable/n-1/ (tc a)
-//	instance (Typeable a, Typeable b) => Typeable/n-2/ (tc a b)
-//	...
-//	instance (Typeable a1, ..., Typeable an) => Typeable (tc a1 ... an)
+//      instance Typeable/n/ tc
+//      instance Typeable a => Typeable/n-1/ (tc a)
+//      instance (Typeable a, Typeable b) => Typeable/n-2/ (tc a b)
+//      ...
+//      instance (Typeable a1, ..., Typeable an) => Typeable (tc a1 ... an)
 // --------------------------------------------------------------------------
 -}
 
 #ifndef TYPEABLE_H
 #define TYPEABLE_H
 
-#define INSTANCE_TYPEABLE0(tycon,tcname,str) \
-tcname :: TyCon; \
-tcname = mkTyCon str; \
-instance Typeable tycon where { typeOf _ = mkTyConApp tcname [] }
-
 #ifdef __GLASGOW_HASKELL__
 
---  // For GHC, the extra instances follow from general instance declarations
---  // defined in Data.Typeable.
+--  // For GHC, we can use DeriveDataTypeable + StandaloneDeriving to
+--  // generate the instances.
 
-#define INSTANCE_TYPEABLE1(tycon,tcname,str) \
-tcname :: TyCon; \
-tcname = mkTyCon str; \
-instance Typeable1 tycon where { typeOf1 _ = mkTyConApp tcname [] }
+#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon
+#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable1 tycon
+#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable2 tycon
+#define INSTANCE_TYPEABLE3(tycon,tcname,str) deriving instance Typeable3 tycon
 
-#define INSTANCE_TYPEABLE2(tycon,tcname,str) \
-tcname :: TyCon; \
-tcname = mkTyCon str; \
-instance Typeable2 tycon where { typeOf2 _ = mkTyConApp tcname [] }
+#else /* !__GLASGOW_HASKELL__ */
 
-#define INSTANCE_TYPEABLE3(tycon,tcname,str) \
+#define INSTANCE_TYPEABLE0(tycon,tcname,str) \
 tcname :: TyCon; \
 tcname = mkTyCon str; \
-instance Typeable3 tycon where { typeOf3 _ = mkTyConApp tcname [] }
-
-#else /* !__GLASGOW_HASKELL__ */
+instance Typeable tycon where { typeOf _ = mkTyConApp tcname [] }
 
 #define INSTANCE_TYPEABLE1(tycon,tcname,str) \
-tcname :: TyCon; \
 tcname = mkTyCon str; \
 instance Typeable1 tycon where { typeOf1 _ = mkTyConApp tcname [] }; \
 instance Typeable a => Typeable (tycon a) where { typeOf = typeOfDefault }
 
 #define INSTANCE_TYPEABLE2(tycon,tcname,str) \
-tcname :: TyCon; \
 tcname = mkTyCon str; \
 instance Typeable2 tycon where { typeOf2 _ = mkTyConApp tcname [] }; \
 instance Typeable a => Typeable1 (tycon a) where { \
@@ -57,7 +45,6 @@
   typeOf = typeOfDefault }
 
 #define INSTANCE_TYPEABLE3(tycon,tcname,str) \
-tcname :: TyCon; \
 tcname = mkTyCon str; \
 instance Typeable3 tycon where { typeOf3 _ = mkTyConApp tcname [] }; \
 instance Typeable a => Typeable2 (tycon a) where { \
diff --git a/multiset.cabal b/multiset.cabal
--- a/multiset.cabal
+++ b/multiset.cabal
@@ -1,7 +1,8 @@
 name:             multiset
-version:          0.2.1
+version:          0.2.2
 author:           Twan van Laarhoven
 maintainer:       twanvl@gmail.com
+bug-reports:      https://github.com/twanvl/multiset/issues
 category:         Data Structures
 synopsis:         The Data.MultiSet container type
 description:
@@ -10,13 +11,17 @@
 license:          BSD3
 license-file:     LICENSE
 build-type:       Simple
-Cabal-version:    >= 1.2
+Cabal-version:    >= 1.6
 extra-source-files: include/Typeable.h
 
+source-repository head
+    type:     git
+    location: http://github.com/twanvl/multiset.git
+
 Library
   exposed-modules:    Data.MultiSet, Data.IntMultiSet
 
   include-dirs:       include
   extensions:         CPP
   ghc-options:        -Wall
-  build-depends:      containers, base >= 4 && < 5
+  build-depends:      containers >= 0.5, base >= 4 && < 5
