diff --git a/Biobase/Primary.hs b/Biobase/Primary.hs
--- a/Biobase/Primary.hs
+++ b/Biobase/Primary.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE PackageImports #-}
 {-# LANGUAGE TypeOperators #-}
 {-# LANGUAGE PatternGuards #-}
 {-# LANGUAGE OverlappingInstances #-}
@@ -19,9 +20,10 @@
 
 module Biobase.Primary where
 
-import Data.Array.Repa.Index
-import Data.Array.Repa.Shape
+import "PrimitiveArray" Data.Array.Repa.Index
+import "PrimitiveArray" Data.Array.Repa.Shape
 import Data.Char (toUpper)
+import Data.ExtShape
 import Data.Ix (Ix(..))
 import Data.Primitive.Types
 import Data.Tuple (swap)
@@ -33,6 +35,9 @@
 import qualified Data.Vector.Generic.Mutable as VGM
 import qualified Data.Vector.Unboxed as VU
 
+import Data.PrimitiveArray
+import Data.PrimitiveArray.Unboxed.Zero
+
 import Biobase.Primary.Bounds
 
 
@@ -46,10 +51,24 @@
 class MkPrimary a where
   mkPrimary :: a -> Primary
 
-type Primary = VU.Vector Nuc
+type Primary = Arr0 DIM1 Nuc
 
+instance Eq Primary where
+  xs == ys
+    | bx==by = sliceEq xs zeroDim ys zeroDim bx
+    | otherwise = False
+    where (_,bx) = bounds xs
+          (_,by) = bounds ys
 
+instance Ord Primary where
+  xs <= ys
+    | bx==by    = toList xs <= toList ys
+    | otherwise = bx<=by
+    where (_,Z:.bx) = bounds xs
+          (_,Z:.by) = bounds ys
 
+
+
 -- * Efficient nucleotide encoding
 
 -- A 'Nuc'leotide is simply an Int wrapped up. 'nIMI' provides for
@@ -157,6 +176,10 @@
   {-# INLINE shapeOfList #-}
   {-# INLINE deepSeq #-}
 
+instance (Shape sh, Show sh, ExtShape sh) => ExtShape (sh :. Nuc) where
+  subDim (sh1:.Nuc n1) (sh2:.Nuc n2) = subDim sh1 sh2 :. Nuc (n1-n2)
+  rangeList (sh1:.Nuc n1) (sh2:.Nuc n2) = [ sh:.Nuc n | sh <- rangeList sh1 sh2, n <- [n1 .. (n1+n2)]]
+
 -- | The bounded instance from GHC proper. Captures all defined symbols.
 
 instance Bounded Nuc where
@@ -180,7 +203,7 @@
 -- ** Instances for 'MkPrimary'
 
 instance MkPrimary String where
-  mkPrimary = VU.fromList . map mkNuc
+  mkPrimary xs = fromList (Z:.0) (Z:.length xs -1) $ map mkNuc xs
 
 instance MkPrimary BS.ByteString where
   mkPrimary = mkPrimary . BS.unpack
@@ -192,5 +215,5 @@
   mkPrimary = mkPrimary . T.unpack
 
 instance MkPrimary [Nuc] where
-  mkPrimary = VU.fromList
+  mkPrimary xs = fromList (Z:.0) (Z:.length xs -1) xs
 
diff --git a/Biobase/Primary/Hashed.hs b/Biobase/Primary/Hashed.hs
--- a/Biobase/Primary/Hashed.hs
+++ b/Biobase/Primary/Hashed.hs
@@ -14,6 +14,8 @@
 import qualified Data.Vector.Generic.Mutable as VGM
 import qualified Data.Vector.Unboxed as VU
 
+import Data.PrimitiveArray
+
 import Biobase.Primary
 
 
@@ -35,10 +37,14 @@
 -- with each other. All indices start at 0.
 --
 -- The empty input produces an index of 0.
+--
+-- TODO currently goes the very inefficient way of creating a temporary vector
+-- for 'ps'. We could in O(1) create a vector from a Primary ...
 
 mkHashedPrimary :: (Nuc,Nuc) -> Primary -> HashedPrimary
-mkHashedPrimary (l,u) ps = assert (VU.all (\p -> l<=p && p<=u) ps) $ HashedPrimary idx where
+mkHashedPrimary (l,u) ps' = assert (VU.all (\p -> l<=p && p<=u) ps) $ HashedPrimary idx where
   idx   = VU.sum $ VU.zipWith f ps (VU.enumFromStepN (VU.length ps -1) (-1) (VU.length ps))
   f p c = (unNuc p - unNuc l) * (cnst^c)
   cnst = unNuc u - unNuc l + 1
+  ps = VU.fromList $ toList ps'
 {-# INLINE mkHashedPrimary #-}
diff --git a/Biobase/Secondary.hs b/Biobase/Secondary.hs
--- a/Biobase/Secondary.hs
+++ b/Biobase/Secondary.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE PackageImports #-}
 {-# LANGUAGE TypeOperators #-}
 {-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE PatternGuards #-}
@@ -16,8 +17,8 @@
 
 module Biobase.Secondary where
 
-import Data.Array.Repa.Index
-import Data.Array.Repa.Shape
+import "PrimitiveArray" Data.Array.Repa.Index
+import "PrimitiveArray" Data.Array.Repa.Shape
 import Data.Char (toLower, toUpper)
 import Data.Ix (Ix(..))
 import Data.List as L
diff --git a/Biobase/Secondary/Constraint.hs b/Biobase/Secondary/Constraint.hs
--- a/Biobase/Secondary/Constraint.hs
+++ b/Biobase/Secondary/Constraint.hs
@@ -15,7 +15,7 @@
 import qualified Data.Vector.Unboxed as VU
 
 import Data.PrimitiveArray
-import Data.PrimitiveArray.Unboxed
+import Data.PrimitiveArray.Unboxed.Zero
 
 import Biobase.Secondary.Diagrams
 
@@ -50,7 +50,7 @@
 -- TODO and again, we should parametrize over "Energy", "Score", etc (that is,
 -- Prim a)
 
-bonusTable :: Double -> Double -> Constraint -> PrimArray DIM2 Double
+bonusTable :: Double -> Double -> Constraint -> Arr0 DIM2 Double
 bonusTable bonus malus (Constraint constraint) = arr where
   arr = fromAssocs zeroDim (Z:.n:.n) 0 $ bonusBr ++ bonusAn ++ bonusBa ++ malusBr ++ malusAn ++ malusX
   n = VU.length constraint -1
diff --git a/Biobase/Secondary/Isostericity.hs b/Biobase/Secondary/Isostericity.hs
--- a/Biobase/Secondary/Isostericity.hs
+++ b/Biobase/Secondary/Isostericity.hs
@@ -87,7 +87,7 @@
             ) $ map entry xs where
     bpt = head $ head g
     xs = tail g
-    entry x = (x!!0, takeWhile ((=='I') . head) $ drop 2 x)
+    entry x = (x!!0, map (filter (\z -> not $ z `elem` "()")) . takeWhile ('I' `elem`) . drop 2 $ x)
   turn entry@(((x,y),(wc,tx,ty)), cs) = [entry, (((y,x),(wc,ty,tx)), cs)]
 
 -- | Simple parsing of raw CSV data.
diff --git a/Biobase/Secondary/Vienna.hs b/Biobase/Secondary/Vienna.hs
--- a/Biobase/Secondary/Vienna.hs
+++ b/Biobase/Secondary/Vienna.hs
@@ -11,7 +11,10 @@
 
 import Data.Array.Repa.Index
 import Data.Array.Repa.Shape
+import Data.ExtShape
 import Data.Ix
+import Data.PrimitiveArray as PA
+import Data.PrimitiveArray.Unboxed.Zero as PA
 import Data.Primitive.Types
 import Data.Tuple (swap)
 import GHC.Base (remInt,quotInt)
@@ -61,6 +64,10 @@
   {-# INLINE shapeOfList #-}
   {-# INLINE deepSeq #-}
 
+instance (Eq sh, Shape sh, Show sh, ExtShape sh) => ExtShape (sh :. ViennaPair) where
+  subDim (sh1:.ViennaPair n1) (sh2:.ViennaPair n2) = subDim sh1 sh2 :. (ViennaPair $ n1-n2)
+  rangeList (sh1:.ViennaPair n1) (sh2:.ViennaPair n2) = [sh:.ViennaPair n | sh <- rangeList sh1 sh2, n <- [n1 .. (n1+n2)]]
+
 (vpNP:vpCG:vpGC:vpGU:vpUG:vpAU:vpUA:vpNS:vpUndefined:_) = map ViennaPair [0..]
 
 class MkViennaPair a where
@@ -68,7 +75,8 @@
   fromViennaPair :: ViennaPair -> a
 
 instance MkViennaPair (Nuc,Nuc) where
-  mkViennaPair (b1,b2)
+  mkViennaPair (b1,b2) = viennaPairTable `PA.index` (Z:.b1:.b2)
+  {-
     | b1==nC&&b2==nG = vpCG
     | b1==nG&&b2==nC = vpGC
     | b1==nG&&b2==nU = vpGU
@@ -76,6 +84,8 @@
     | b1==nA&&b2==nU = vpAU
     | b1==nU&&b2==nA = vpUA
     | otherwise = vpNS
+  -}
+  {-# INLINE mkViennaPair #-}
   fromViennaPair p
     | p==vpCG = (nC,nG)
     | p==vpGC = (nG,nC)
@@ -84,7 +94,19 @@
     | p==vpAU = (nA,nU)
     | p==vpUA = (nU,nA)
     | otherwise = error "non-standard pairs can't be backcasted"
+  {-# INLINE fromViennaPair #-}
 
+viennaPairTable :: Arr0 (Z:.Nuc:.Nuc) ViennaPair
+viennaPairTable = fromAssocs (Z:.nN:.nN) (Z:.nU:.nU) vpNS
+  [ (Z:.nC:.nG , vpCG)
+  , (Z:.nG:.nC , vpGC)
+  , (Z:.nG:.nU , vpGU)
+  , (Z:.nU:.nG , vpUG)
+  , (Z:.nA:.nU , vpAU)
+  , (Z:.nU:.nA , vpUA)
+  ]
+{-# NOINLINE viennaPairTable #-}
+
 deriving instance VGM.MVector VU.MVector ViennaPair
 deriving instance VG.Vector VU.Vector ViennaPair
 deriving instance VU.Unbox ViennaPair
@@ -111,6 +133,7 @@
 instance Show ViennaPair where
   show x
     | Just s <- x `lookup` pairToString = s
+    | otherwise = "??"
 
 instance Read ViennaPair where
   readsPrec p [] = []
diff --git a/BiobaseXNA.cabal b/BiobaseXNA.cabal
--- a/BiobaseXNA.cabal
+++ b/BiobaseXNA.cabal
@@ -1,5 +1,5 @@
 name:           BiobaseXNA
-version:        0.6.0.0
+version:        0.6.2.0
 author:         Christian Hoener zu Siederdissen
 maintainer:     choener@tbi.univie.ac.at
 homepage:       http://www.tbi.univie.ac.at/~choener/
@@ -30,9 +30,9 @@
                 .
                 .
                 .
-                New in 0.6.0.0
+                New in 0.6.2.0
                 .
-                * Updated to PrimitiveArrays >= 0.1
+                * Updated to PrimitiveArray >= 0.2.0.0
 
 extra-source-files:
   sources/isostericity-matrices.csv
@@ -49,8 +49,7 @@
     text,
     tuple,
     vector >=0.9 && <0.10,
-    repa >= 2,
-    PrimitiveArray >= 0.1.1.2
+    PrimitiveArray == 0.2.0.0
 
   exposed-modules:
     Biobase.Primary
@@ -64,7 +63,7 @@
     Biobase.Secondary.Vienna
 
   ghc-options:
-    -Odph -funbox-strict-fields
+    -Odph -funbox-strict-fields -fspec-constr
 
 source-repository head
   type: git
