diff --git a/knit.cabal b/knit.cabal
--- a/knit.cabal
+++ b/knit.cabal
@@ -7,7 +7,7 @@
 -- hash: 9a018114683474c6cf3790641de1ab1452d949f9accab039ef8c9c01bc3dcf91
 
 name:           knit
-version:        0.3.0.0
+version:        0.4.0.0
 synopsis:       Ties the knot on data structures that reference each other by unique keys.
 description:    Please see the README on GitHub at <https://github.com/pkamenarsky/knit#readme>
 category:       Data Structures
diff --git a/src/Knit.hs b/src/Knit.hs
--- a/src/Knit.hs
+++ b/src/Knit.hs
@@ -4,32 +4,17 @@
 {-# LANGUAGE ExistentialQuantification #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE RankNTypes #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE UndecidableInstances #-}
 
-module Knit
-  ( KnitRecord
-  , KnitTables
-  , Mode (..)
-
-  , Table
-  , Lazy (..)
-
-  , Id
-  , ForeignId
-
-  , RecordId (..)
-  , ForeignRecordId (..)
-
-  , ResolveError (..)
-
-  , knit
-  )where
+module Knit where
 
 import           Control.DeepSeq (NFData)
 import qualified Control.Monad.ST as ST
@@ -505,7 +490,12 @@
         [ case M.lookup (table, field, show k) recordMap of
             Nothing -> Just (table, field, show k)
             Just _ -> Nothing
-        | (_, [(_, _, fids)]) <- M.toList recordMap
+        | (_, records) <- eids
+        , record <- records
+        , let fids =
+                [ fid
+                | fid@(EForeignId _ _ _) <- record
+                ]
         , EForeignId table field k <- fids
         ]
 
