diff --git a/README b/README
--- a/README
+++ b/README
@@ -111,3 +111,4 @@
 
 For more examples see files all.features and example.features in the
 directory data.
+
diff --git a/lib/Aux/Atom.hs b/lib/Aux/Atom.hs
deleted file mode 100644
--- a/lib/Aux/Atom.hs
+++ /dev/null
@@ -1,88 +0,0 @@
-{-# LANGUAGE  GeneralizedNewtypeDeriving 
-            , NoMonomorphismRestriction 
-            , BangPatterns #-}
-module Aux.Atom 
-    ( MonadAtoms (..)
-    , AtomTable (..)
-    , Atoms
-    , AtomsT
-    , empty
-    , evalAtoms
-    , evalAtomsT
-    , runAtoms
-    , runAtomsT
-    )
-where
-import Control.Monad.State
-import Control.Monad.Identity
-import qualified Data.Map as Map
-import qualified Data.IntMap as IntMap
-import qualified Data.Binary as B
-import qualified Aux.Text as Text
-type Txt = Text.Txt
-
-
-data AtomTable = T { lastID :: !Int 
-                   , to :: Map.Map Txt Int 
-                   , from :: IntMap.IntMap Txt } 
-                   deriving (Eq,Show)
-
-
-instance B.Binary AtomTable where
-    put t = do B.put (lastID t) 
-               B.put (to t)
-               B.put (from t)
-    get = do liftM3 T B.get B.get B.get
-
-
-class Monad m => MonadAtoms m where
-    toAtom :: Txt -> m Int
-    maybeToAtom :: Txt -> m (Maybe Int)
-    fromAtom :: Int -> m Txt
-    table    :: m AtomTable
-
-instance Monad m => MonadAtoms (AtomsT m) where
-    toAtom x = AtomsT $ do
-      t <- get
-      case Map.lookup x (to t) of
-        Just j -> return $! j
-        Nothing -> do 
-                 let i = lastID t
-                     i' = i + 1 
-                     !t' = t { lastID = i'
-                             , to = Map.insert x  i (to t) 
-                             , from = IntMap.insert i x (from t) }
-                 put t'
-                 return $! lastID t
-
-    maybeToAtom x = 
-        AtomsT $ do
-          t <- get
-          return . Map.lookup x . to $ t
-            
-    fromAtom i = AtomsT $ do
-      t <- get
-      return $ (from t) IntMap.! i
-    table = AtomsT get
-
-empty :: AtomTable
-empty = T 0 Map.empty IntMap.empty
-
-runAtomsT :: AtomsT t t1 -> AtomTable -> t (t1, AtomTable)
-runAtomsT (AtomsT x) s = runStateT x s
-
-runAtoms :: Atoms t -> AtomTable -> (t, AtomTable)
-runAtoms (Atoms x) s = runIdentity (runAtomsT x s)
-
-
-evalAtoms :: Atoms t -> t
-evalAtoms = fst . flip runAtoms empty
-
-evalAtomsT :: (Monad m) => AtomsT m a -> m a
-evalAtomsT = liftM fst . flip runAtomsT empty
-
-newtype AtomsT m r = AtomsT (StateT AtomTable m r)
-    deriving (Functor,Monad,MonadTrans,MonadIO)
-
-newtype Atoms r = Atoms (AtomsT Identity r)
-    deriving (Functor,Monad,MonadAtoms)
diff --git a/lib/Aux/Commands.hs b/lib/Aux/Commands.hs
deleted file mode 100644
--- a/lib/Aux/Commands.hs
+++ /dev/null
@@ -1,62 +0,0 @@
-module Aux.Commands 
-    ( Command
-    , CommandName
-    , Help
-    , CommandSpec (..)
-    , module System.Console.GetOpt
-    , defaultMain
-    , usage
-    )
-where
-import Text.PrettyPrint(renderStyle,render,nest,vcat,hsep,style
-                       ,Mode(..),mode,text,(<>),($$),($+$),(<+>))
-import System.Console.GetOpt
-import System.Environment (getArgs)
-import System.IO (stderr,hPutStr)
-import qualified Data.List as List
-
-
-type Command opts = (opts -> [String] -> IO ())
-type CommandName = String
-type Help        = String
-data CommandSpec opts =  CommandSpec (Command opts)
-                                  Help     
-                                  [OptDescr (opts -> opts)]
-                                  [String]
-
-defaultMain :: opts -> [(String, CommandSpec opts)] -> String -> IO ()
-defaultMain def commands header = do
-  args <- getArgs
-  let theUsage = usage commands header
-  case args of
-    []           -> theUsage []
-    command:opts -> case List.lookup command commands of
-                      Nothing   -> theUsage  ["Invalid command: " ++ command]
-                      Just spec -> runCommand theUsage def spec opts
-
-runCommand :: ([String] -> IO ()) 
-           -> opts 
-           -> CommandSpec opts 
-           -> [String] 
-           -> IO ()
-runCommand theUsage def (CommandSpec command help optDesc argnames) args = 
-    case getOpt Permute optDesc args of
-      (o,n,[]  ) ->  command (foldr ($) def o) n
-      (_,_,errs) -> theUsage errs
-
-usage :: [(String, CommandSpec t)] -> String -> [String] -> IO ()
-usage commands header errs = hPutStr stderr . render 
-                             $  vcat (List.map text errs)
-                             $$ usageMsg commands header
-
-usageMsg commands header = 
-        text header
-    $+$ (vcat (List.map commandUsage commands))
-
-commandUsage (name , CommandSpec command help optionDesc args) = 
-    text name <> text ":"
-    $$ (nest 10 (text help))
-    $$ (text name <+> text (if null optionDesc then "" else "[OPTION...]")
-                  <+> hsep (map text args))
-    <+>  (nest 10 (text $ usageInfo "" optionDesc))
-
diff --git a/lib/Aux/ListZipper.hs b/lib/Aux/ListZipper.hs
deleted file mode 100644
--- a/lib/Aux/ListZipper.hs
+++ /dev/null
@@ -1,76 +0,0 @@
-module Aux.ListZipper 
-    ( 
-     ListZipper(..)
-    , focus
-    , left
-    , right
-    , reset
-    , fromList
-    , toZippers
-    , toList
-    , next
-    , atEnd 
-    , at
-    )
-where
-import Data.Maybe
-import Data.Monoid
-import Data.Foldable (Foldable,foldMap)
-
-
-data ListZipper a = LZ [a] (Maybe a) [a]  deriving (Show,Eq,Ord)
-
-left :: ListZipper a -> [a]
-left  (LZ xs _ _) = xs
-
-focus :: ListZipper a -> Maybe a
-focus (LZ _ x _)  = x
-
-right :: ListZipper a -> [a]
-right (LZ _ _ ys) = ys
-
-fromList []     = LZ [] Nothing [] 
-fromList (x:xs) = LZ [] (Just x) xs
-
-toZippers xs = let zs = iterate next . fromList $ xs
-               in map snd . zip xs $ zs
-
-toList (LZ xs (Just x) ys) = reverse xs ++ [x] ++ ys
-toList (LZ xs Nothing [])  = reverse xs
-
-next :: ListZipper a -> ListZipper a
-next = nextWith id id
-nextWith f g (LZ lxs (Just x) rxs)  =
-    case rxs of
-      y:ys -> LZ (f x:lxs) (Just (g y)) ys
-      []   -> LZ (f x:lxs) Nothing []
-
-atEnd :: ListZipper a -> Bool
-atEnd = isNothing . focus
-
-reset (LZ [] (Just y) ys)     = LZ [] (Just y) ys
-reset (LZ [] Nothing [])      = LZ [] Nothing []
-reset (LZ xs (Just y) ys) = LZ [] (Just z) (zs++[y]++ys)
-    where z:zs = reverse xs                    
-reset (LZ xs Nothing [])  = LZ [] (Just z) zs
-    where z:zs = reverse xs
-
-from :: (Monoid m) => Maybe m -> m
-from Nothing  = mempty
-from (Just x) = x
-
-index 1 (x:xs)  = Just x
-index i []  = Nothing
-index i (x:xs) = index (i-1) xs
-
-at :: (Monoid m) =>  ListZipper m -> Int -> m
-at  z 0 = from . focus $ z
-at  z i | i < 0 = from .  index (negate i) . left  $ z
-at  z i         = from .  index i          . right $ z
-
-instance Functor ListZipper where
-    fmap f (LZ ls x rs) = LZ (fmap f ls) (fmap f x) (fmap f rs) 
-instance Foldable ListZipper where
-    foldMap f (LZ ls x rs) = mconcat $ fmap f (reverse ls) 
-                             ++ [from $ fmap f x] ++ fmap f rs
-
diff --git a/lib/Aux/Text.hs b/lib/Aux/Text.hs
deleted file mode 100644
--- a/lib/Aux/Text.hs
+++ /dev/null
@@ -1,111 +0,0 @@
-{-# LANGUAGE OverloadedStrings 
-  , TypeSynonymInstances 
-  #-}
-module Aux.Text 
-    ( Txt
-    , module Data.Text.Lazy
-    , module Data.Text.Lazy.Encoding
-    , splitOn
-    , show
-    , read
-    , reads
-    , readDouble
-    , readInt
-    , normalize
-    , fromString
-    , toString
-    , getContents
-    , readFile   
-    , writeFile 
-    , putStr    
-    , putStrLn  
-    , interact 
-    , hPutStr 
-    , hPutStrLn
-    )
-    where
-import Data.Text.Lazy hiding (splitOn)
-import Data.Text.Lazy.Encoding
-import Data.Text.Lazy.Read
-import System.IO (Handle)
-import qualified Data.Text.Lazy.IO as IO
-import qualified Data.ByteString.Lazy.Char8 as ByteString
-import qualified Data.Text as Strict
-import Data.Binary
-import qualified Aux.Utils as Utils
-import Prelude hiding ( show
-                      , reverse
-                      , map
-                      , read
-                      , reads
-                      , getContents
-                      , readFile   
-                      , writeFile 
-                      , putStr    
-                      , putStrLn  
-                      , interact 
-                      )
-import qualified Prelude
-
-type Txt = Text
-
-instance Binary Txt where
-    put = put . encodeUtf8
-    get = fmap decodeUtf8 get
-
-splitOn :: Char -> Txt -> [Txt]
-splitOn c = Prelude.map pack . Utils.splitOn c . unpack
-
-show :: (Show a) => a -> Txt
-show = pack . Prelude.show
-
-read :: (Read a) => Txt -> a
-read = Prelude.read . unpack
-
-reads :: (Read a) => Txt -> [(a,Txt)]
-reads = Prelude.map (\ (r,s) -> (r,pack s)) . Prelude.reads . unpack
-
-readDouble :: Txt -> Double 
-readDouble t = case double t of
-                 Right (d,"") -> d
-                 Left err -> error err
-
-readInt :: Txt -> Int
-readInt t = case decimal t of
-              Right (d,"") -> d
-              Left err -> error err
-
-fromString :: String -> Txt
-fromString = pack
-
-toString :: Txt -> String
-toString = unpack
-
-normalize :: Txt -> Txt
-normalize = fromChunks . return . Strict.concat . toChunks
-
-getContents :: IO Txt
-getContents = decodeUtf8 `fmap` ByteString.getContents
-
-readFile :: FilePath -> IO Txt
-readFile  f = decodeUtf8 `fmap` ByteString.readFile f
-
-writeFile :: FilePath -> Txt -> IO ()
-writeFile f = ByteString.writeFile f . encodeUtf8
-
-putStr :: Txt -> IO ()
-putStr = ByteString.putStr . encodeUtf8
-
-putStrLn :: Txt -> IO ()
-putStrLn = ByteString.putStrLn . encodeUtf8
-
-interact :: (Txt -> Txt) -> IO ()
-interact f  = ByteString.interact (encodeUtf8 . f . decodeUtf8)
-
-hPutStr :: Handle -> Txt -> IO ()
-hPutStr h = ByteString.hPutStr h . encodeUtf8
-
-hPutStrLn :: Handle -> Txt -> IO ()
-hPutStrLn h s = do ByteString.hPutStr h . encodeUtf8 $ s
-                   ByteString.hPutStr h . encodeUtf8 $ "\n"
-
diff --git a/lib/Aux/Utils.hs b/lib/Aux/Utils.hs
deleted file mode 100644
--- a/lib/Aux/Utils.hs
+++ /dev/null
@@ -1,44 +0,0 @@
-{-# LANGUAGE BangPatterns #-}
-
-module Aux.Utils 
-    ( splitOn
-    , splitWith
-    , padRight
-    , uniq
-    , accuracy
-    , mean
-    , (#)
-    )
-where
-import Data.List (foldl')
-import qualified Data.Set as Set
-import qualified Data.Map as Map
-
-splitOn :: (Eq a) => a -> [a] -> [[a]]
-splitOn = splitWith . (==)
-
-splitWith ::  (a -> Bool) -> [a] -> [[a]]
-splitWith f s =  case dropWhile f s of
-                   [] -> []
-                   s' -> w : splitWith f s''
-                       where (w, s'') = break f s'
-
-padRight :: a -> Int -> [a] -> [a]
-padRight x i xs = take i (xs ++ repeat x)
-
-uniq :: (Ord a) => [a] -> [a]
-uniq = Set.toList . Set.fromList
-
-accuracy predicted testset  = 
-    fromIntegral (foldl' (+) 0 (zipWith ((fromEnum .) . (==)) predicted 
-                                                              testset))
-                              / 
-                              fromIntegral (length testset)
-
-{-# SPECIALIZE mean :: [Double] -> Double #-}
-mean :: (Fractional a) => [a] -> a
-mean =   uncurry (/) 
-       . foldl' (\ (!s,!n) x -> (s+x,n+1)) (0,0)
-
-(#) :: (Show k,Ord k) => Map.Map k a -> k -> a
-m # i = Map.findWithDefault (error $ "#: not found: " ++ show i) i m
diff --git a/lib/Helper/Atom.hs b/lib/Helper/Atom.hs
new file mode 100644
--- /dev/null
+++ b/lib/Helper/Atom.hs
@@ -0,0 +1,88 @@
+{-# LANGUAGE  GeneralizedNewtypeDeriving 
+            , NoMonomorphismRestriction 
+            , BangPatterns #-}
+module Helper.Atom 
+    ( MonadAtoms (..)
+    , AtomTable (..)
+    , Atoms
+    , AtomsT
+    , empty
+    , evalAtoms
+    , evalAtomsT
+    , runAtoms
+    , runAtomsT
+    )
+where
+import Control.Monad.State
+import Control.Monad.Identity
+import qualified Data.Map as Map
+import qualified Data.IntMap as IntMap
+import qualified Data.Binary as B
+import qualified Helper.Text as Text
+type Txt = Text.Txt
+
+
+data AtomTable = T { lastID :: !Int 
+                   , to :: Map.Map Txt Int 
+                   , from :: IntMap.IntMap Txt } 
+                   deriving (Eq,Show)
+
+
+instance B.Binary AtomTable where
+    put t = do B.put (lastID t) 
+               B.put (to t)
+               B.put (from t)
+    get = do liftM3 T B.get B.get B.get
+
+
+class Monad m => MonadAtoms m where
+    toAtom :: Txt -> m Int
+    maybeToAtom :: Txt -> m (Maybe Int)
+    fromAtom :: Int -> m Txt
+    table    :: m AtomTable
+
+instance Monad m => MonadAtoms (AtomsT m) where
+    toAtom x = AtomsT $ do
+      t <- get
+      case Map.lookup x (to t) of
+        Just j -> return $! j
+        Nothing -> do 
+                 let i = lastID t
+                     i' = i + 1 
+                     !t' = t { lastID = i'
+                             , to = Map.insert x  i (to t) 
+                             , from = IntMap.insert i x (from t) }
+                 put t'
+                 return $! lastID t
+
+    maybeToAtom x = 
+        AtomsT $ do
+          t <- get
+          return . Map.lookup x . to $ t
+            
+    fromAtom i = AtomsT $ do
+      t <- get
+      return $ (from t) IntMap.! i
+    table = AtomsT get
+
+empty :: AtomTable
+empty = T 0 Map.empty IntMap.empty
+
+runAtomsT :: AtomsT t t1 -> AtomTable -> t (t1, AtomTable)
+runAtomsT (AtomsT x) s = runStateT x s
+
+runAtoms :: Atoms t -> AtomTable -> (t, AtomTable)
+runAtoms (Atoms x) s = runIdentity (runAtomsT x s)
+
+
+evalAtoms :: Atoms t -> t
+evalAtoms = fst . flip runAtoms empty
+
+evalAtomsT :: (Monad m) => AtomsT m a -> m a
+evalAtomsT = liftM fst . flip runAtomsT empty
+
+newtype AtomsT m r = AtomsT (StateT AtomTable m r)
+    deriving (Functor,Monad,MonadTrans,MonadIO)
+
+newtype Atoms r = Atoms (AtomsT Identity r)
+    deriving (Functor,Monad,MonadAtoms)
diff --git a/lib/Helper/Commands.hs b/lib/Helper/Commands.hs
new file mode 100644
--- /dev/null
+++ b/lib/Helper/Commands.hs
@@ -0,0 +1,62 @@
+module Helper.Commands 
+    ( Command
+    , CommandName
+    , Help
+    , CommandSpec (..)
+    , module System.Console.GetOpt
+    , defaultMain
+    , usage
+    )
+where
+import Text.PrettyPrint(renderStyle,render,nest,vcat,hsep,style
+                       ,Mode(..),mode,text,(<>),($$),($+$),(<+>))
+import System.Console.GetOpt
+import System.Environment (getArgs)
+import System.IO (stderr,hPutStr)
+import qualified Data.List as List
+
+
+type Command opts = (opts -> [String] -> IO ())
+type CommandName = String
+type Help        = String
+data CommandSpec opts =  CommandSpec (Command opts)
+                                  Help     
+                                  [OptDescr (opts -> opts)]
+                                  [String]
+
+defaultMain :: opts -> [(String, CommandSpec opts)] -> String -> IO ()
+defaultMain def commands header = do
+  args <- getArgs
+  let theUsage = usage commands header
+  case args of
+    []           -> theUsage []
+    command:opts -> case List.lookup command commands of
+                      Nothing   -> theUsage  ["Invalid command: " ++ command]
+                      Just spec -> runCommand theUsage def spec opts
+
+runCommand :: ([String] -> IO ()) 
+           -> opts 
+           -> CommandSpec opts 
+           -> [String] 
+           -> IO ()
+runCommand theUsage def (CommandSpec command help optDesc argnames) args = 
+    case getOpt Permute optDesc args of
+      (o,n,[]  ) ->  command (foldr ($) def o) n
+      (_,_,errs) -> theUsage errs
+
+usage :: [(String, CommandSpec t)] -> String -> [String] -> IO ()
+usage commands header errs = hPutStr stderr . render 
+                             $  vcat (List.map text errs)
+                             $$ usageMsg commands header
+
+usageMsg commands header = 
+        text header
+    $+$ (vcat (List.map commandUsage commands))
+
+commandUsage (name , CommandSpec command help optionDesc args) = 
+    text name <> text ":"
+    $$ (nest 10 (text help))
+    $$ (text name <+> text (if null optionDesc then "" else "[OPTION...]")
+                  <+> hsep (map text args))
+    <+>  (nest 10 (text $ usageInfo "" optionDesc))
+
diff --git a/lib/Helper/ListZipper.hs b/lib/Helper/ListZipper.hs
new file mode 100644
--- /dev/null
+++ b/lib/Helper/ListZipper.hs
@@ -0,0 +1,76 @@
+module Helper.ListZipper 
+    ( 
+     ListZipper(..)
+    , focus
+    , left
+    , right
+    , reset
+    , fromList
+    , toZippers
+    , toList
+    , next
+    , atEnd 
+    , at
+    )
+where
+import Data.Maybe
+import Data.Monoid
+import Data.Foldable (Foldable,foldMap)
+
+
+data ListZipper a = LZ [a] (Maybe a) [a]  deriving (Show,Eq,Ord)
+
+left :: ListZipper a -> [a]
+left  (LZ xs _ _) = xs
+
+focus :: ListZipper a -> Maybe a
+focus (LZ _ x _)  = x
+
+right :: ListZipper a -> [a]
+right (LZ _ _ ys) = ys
+
+fromList []     = LZ [] Nothing [] 
+fromList (x:xs) = LZ [] (Just x) xs
+
+toZippers xs = let zs = iterate next . fromList $ xs
+               in map snd . zip xs $ zs
+
+toList (LZ xs (Just x) ys) = reverse xs ++ [x] ++ ys
+toList (LZ xs Nothing [])  = reverse xs
+
+next :: ListZipper a -> ListZipper a
+next = nextWith id id
+nextWith f g (LZ lxs (Just x) rxs)  =
+    case rxs of
+      y:ys -> LZ (f x:lxs) (Just (g y)) ys
+      []   -> LZ (f x:lxs) Nothing []
+
+atEnd :: ListZipper a -> Bool
+atEnd = isNothing . focus
+
+reset (LZ [] (Just y) ys)     = LZ [] (Just y) ys
+reset (LZ [] Nothing [])      = LZ [] Nothing []
+reset (LZ xs (Just y) ys) = LZ [] (Just z) (zs++[y]++ys)
+    where z:zs = reverse xs                    
+reset (LZ xs Nothing [])  = LZ [] (Just z) zs
+    where z:zs = reverse xs
+
+from :: (Monoid m) => Maybe m -> m
+from Nothing  = mempty
+from (Just x) = x
+
+index 1 (x:xs)  = Just x
+index i []  = Nothing
+index i (x:xs) = index (i-1) xs
+
+at :: (Monoid m) =>  ListZipper m -> Int -> m
+at  z 0 = from . focus $ z
+at  z i | i < 0 = from .  index (negate i) . left  $ z
+at  z i         = from .  index i          . right $ z
+
+instance Functor ListZipper where
+    fmap f (LZ ls x rs) = LZ (fmap f ls) (fmap f x) (fmap f rs) 
+instance Foldable ListZipper where
+    foldMap f (LZ ls x rs) = mconcat $ fmap f (reverse ls) 
+                             ++ [from $ fmap f x] ++ fmap f rs
+
diff --git a/lib/Helper/Text.hs b/lib/Helper/Text.hs
new file mode 100644
--- /dev/null
+++ b/lib/Helper/Text.hs
@@ -0,0 +1,123 @@
+{-# LANGUAGE OverloadedStrings 
+  , TypeSynonymInstances 
+  #-}
+module Helper.Text 
+    ( Txt
+    , module Data.Text.Lazy 
+    , module Data.Text.Lazy.Encoding
+    , splitOn
+    , show
+    , read
+    , reads
+    , readDouble
+    , readInt
+    , normalize
+    , fromString
+    , toString
+    , getContents
+    , readFile   
+    , getLine
+    , writeFile 
+    , putStr    
+    , putStrLn  
+    , interact 
+    , hPutStr 
+    , hPutStrLn
+    )
+    where
+import Data.Text.Lazy hiding (splitOn)
+import Data.Text.Lazy.Encoding
+import Data.Text.Lazy.Read
+import System.IO (Handle)
+import qualified Data.Text.Lazy.IO as IO
+import qualified Data.Text.IO as StrictIO
+import qualified Data.ByteString.Lazy.Char8 as ByteString
+import qualified Data.Text as Strict
+import Data.Binary
+import qualified Helper.Utils as Utils
+import Prelude hiding ( show
+                      , reverse
+                      , map
+                      , read
+                      , reads
+                      , getContents
+                      , readFile   
+                      , getLine
+                      , writeFile 
+                      , putStr    
+                      , putStrLn  
+                      , interact 
+                      )
+import qualified Prelude
+
+type Txt = Text
+
+instance Binary Txt where
+    put = put . encodeUtf8
+    get = fmap decodeUtf8 get
+
+splitOn :: Char -> Txt -> [Txt]
+splitOn c = Prelude.map pack . Utils.splitOn c . unpack
+
+show :: (Show a) => a -> Txt
+show = pack . Prelude.show
+
+read :: (Read a) => Txt -> a
+read = Prelude.read . unpack
+
+reads :: (Read a) => Txt -> [(a,Txt)]
+reads = Prelude.map (\ (r,s) -> (r,pack s)) . Prelude.reads . unpack
+
+nan :: Double
+nan = 0/0
+
+readDouble :: Txt -> Double 
+readDouble "NaN" = nan
+readDouble t = case double t of
+                 Right (d,"") -> d
+                 Left err -> error $ "Helper.Text.readDouble: " ++ err
+
+readInt :: Txt -> Int
+readInt t = case decimal t of
+              Right (d,"") -> d
+              Left err -> error $ "Helper.Text.readDouble: " ++ err
+
+fromString :: String -> Txt
+fromString = pack
+
+toString :: Txt -> String
+toString = unpack
+
+normalize :: Txt -> Txt
+normalize = fromChunks . return . Strict.concat . toChunks
+
+getContents :: IO Txt
+getContents = decodeUtf8 `fmap` ByteString.getContents
+
+readFile :: FilePath -> IO Txt
+readFile  f = decodeUtf8 `fmap` ByteString.readFile f
+
+writeFile :: FilePath -> Txt -> IO ()
+writeFile f = ByteString.writeFile f . encodeUtf8
+
+putStr :: Txt -> IO ()
+putStr = ByteString.putStr . encodeUtf8
+
+putStrLn :: Txt -> IO ()
+putStrLn = ByteString.putStrLn . encodeUtf8
+
+interact :: (Txt -> Txt) -> IO ()
+interact f  = ByteString.interact (encodeUtf8 . f . decodeUtf8)
+
+hPutStr :: Handle -> Txt -> IO ()
+hPutStr h = ByteString.hPutStr h . encodeUtf8
+
+hPutStrLn :: Handle -> Txt -> IO ()
+hPutStrLn h s = do ByteString.hPutStr h . encodeUtf8 $ s
+                   ByteString.hPutStr h . encodeUtf8 $ "\n"
+
+getLine :: IO Txt
+getLine = do
+  ln <- StrictIO.getLine
+  return $ fromChunks [ln]
+  
diff --git a/lib/Helper/Utils.hs b/lib/Helper/Utils.hs
new file mode 100644
--- /dev/null
+++ b/lib/Helper/Utils.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE BangPatterns #-}
+
+module Helper.Utils 
+    ( splitOn
+    , splitWith
+    , padRight
+    , uniq
+    , accuracy
+    , mean
+    , (#)
+    )
+where
+import Data.List (foldl')
+import qualified Data.Set as Set
+import qualified Data.Map as Map
+
+splitOn :: (Eq a) => a -> [a] -> [[a]]
+splitOn = splitWith . (==)
+
+splitWith ::  (a -> Bool) -> [a] -> [[a]]
+splitWith f s =  case dropWhile f s of
+                   [] -> []
+                   s' -> w : splitWith f s''
+                       where (w, s'') = break f s'
+
+padRight :: a -> Int -> [a] -> [a]
+padRight x i xs = take i (xs ++ repeat x)
+
+uniq :: (Ord a) => [a] -> [a]
+uniq = Set.toList . Set.fromList
+
+accuracy predicted testset  = 
+    fromIntegral (foldl' (+) 0 (zipWith ((fromEnum .) . (==)) predicted 
+                                                              testset))
+                              / 
+                              fromIntegral (length testset)
+
+{-# SPECIALIZE mean :: [Double] -> Double #-}
+mean :: (Fractional a) => [a] -> a
+mean =   uncurry (/) 
+       . foldl' (\ (!s,!n) x -> (s+x,n+1)) (0,0)
+
+(#) :: (Show k,Ord k) => Map.Map k a -> k -> a
+m # i = Map.findWithDefault (error $ "#: not found: " ++ show i) i m
diff --git a/sequor.cabal b/sequor.cabal
--- a/sequor.cabal
+++ b/sequor.cabal
@@ -1,5 +1,5 @@
 Name:                sequor
-Version:             0.2.2
+Version:             0.2.3
 Description:         A sequence labeler based on Collins's sequence perceptron.
 Synopsis:	     A sequence labeler based on Collins's sequence perceptron.
 Homepage:	     http://code.google.com/p/sequor/
@@ -18,8 +18,8 @@
 
 Executable sequor
   Main-is:           Main.hs
-  Other-modules:     Aux.ListZipper, Aux.Utils, Aux.Text, 
-                     Aux.Atom, Aux.Commands, CorpusReader,
+  Other-modules:     Helper.ListZipper, Helper.Utils, Helper.Text, 
+                     Helper.Atom, Helper.Commands, CorpusReader,
                      FeatureTemplate, Config, Perceptron.Vector,
                      Perceptron.Sequence, Features, Labeler, Hashable
   Build-Depends:     base >= 3 && < 5, containers >= 0.2, 
diff --git a/src/Config.hs b/src/Config.hs
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -3,7 +3,7 @@
     ( Config (..), Flags(..) )
 where
 import Data.Char
-import Aux.Atom (AtomTable)
+import Helper.Atom (AtomTable)
 import qualified Data.Binary as B
 import Control.Monad (ap)
 import FeatureTemplate (Feature)
diff --git a/src/CorpusReader.hs b/src/CorpusReader.hs
--- a/src/CorpusReader.hs
+++ b/src/CorpusReader.hs
@@ -6,10 +6,10 @@
     , fromWords
     )
 where
-import Aux.ListZipper 
-import Aux.Utils (splitWith)
-import qualified Aux.Text as Text
-import Aux.Text (Txt)
+import Helper.ListZipper 
+import Helper.Utils (splitWith)
+import qualified Helper.Text as Text
+import Helper.Text (Txt)
 import Data.Maybe (isJust)
 
 
diff --git a/src/FeatureTemplate.hs b/src/FeatureTemplate.hs
--- a/src/FeatureTemplate.hs
+++ b/src/FeatureTemplate.hs
@@ -6,8 +6,8 @@
     )
 where
 import Data.Binary 
-import Aux.Text(Txt)
-import qualified Aux.Text as Text
+import Helper.Text(Txt)
+import qualified Helper.Text as Text
 import qualified Data.List as List
 import qualified Data.Char as Char
 
diff --git a/src/Features.hs b/src/Features.hs
--- a/src/Features.hs
+++ b/src/Features.hs
@@ -10,16 +10,16 @@
     )
 where
 
-import qualified Aux.Text as Text
-import Aux.Text (Txt)
-import qualified Aux.ListZipper as LZ
-import Aux.ListZipper (ListZipper,at)
+import qualified Helper.Text as Text
+import Helper.Text (Txt)
+import qualified Helper.ListZipper as LZ
+import Helper.ListZipper (ListZipper,at)
 import CorpusReader (Token,fromWords)
 import qualified Data.Char as Char
 import Data.List (group,sort)
 import qualified Data.IntSet as IntSet
 import qualified Data.IntMap as IntMap
-import Aux.Atom (MonadAtoms,AtomTable,from,toAtom,maybeToAtom)
+import Helper.Atom (MonadAtoms,AtomTable,from,toAtom,maybeToAtom)
 import Data.Maybe (catMaybes,isNothing)
 import Control.Monad (liftM2)
 import Data.Monoid (mappend)
diff --git a/src/Hashable.hs b/src/Hashable.hs
--- a/src/Hashable.hs
+++ b/src/Hashable.hs
@@ -29,7 +29,7 @@
 import Data.List (foldl')
 import qualified Data.ByteString as B
 import qualified Data.ByteString.Lazy as BL
-import qualified Aux.Text as Text
+import qualified Helper.Text as Text
 
 -- | The class containing a function 'hash' which computes the hash values of
 -- given value.
diff --git a/src/Labeler.hs b/src/Labeler.hs
--- a/src/Labeler.hs
+++ b/src/Labeler.hs
@@ -14,21 +14,21 @@
 import qualified Data.IntSet as IntSet
 import Data.List (foldl',tails)
 import Data.Maybe (fromMaybe)
-import Aux.ListZipper
+import Helper.ListZipper
 import qualified Perceptron.Sequence as P
 import Perceptron.Sequence (Options(..))
 import CorpusReader (Token)
-import Aux.Utils (splitWith,uniq)
+import Helper.Utils (splitWith,uniq)
 import Text.Printf
-import Aux.Atom
+import Helper.Atom
 import Control.Monad.RWS
 import Features (inputFeatures,features,maybeFeatures,outputFeatures
                 ,indexFeatures)
 import qualified Data.Array as A
 import qualified Data.Vector.Unboxed as V
 import qualified Data.Binary as Binary
-import qualified Aux.Text as Text
-import Aux.Text(Txt)
+import qualified Helper.Text as Text
+import Helper.Text(Txt)
 import Data.Char
 import Data.Maybe (catMaybes)
 import Config 
diff --git a/src/Main.hs b/src/Main.hs
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -2,14 +2,14 @@
 where
 import qualified Labeler as L 
 import CorpusReader (corpus,corpusLabeled)
-import qualified Aux.Text as Text
-import qualified Aux.ListZipper as Z
+import qualified Helper.Text as Text
+import qualified Helper.ListZipper as Z
 import qualified Data.Binary as Binary
 import qualified Data.ByteString.Lazy as ByteString
 import System.Environment (getArgs)
 import System.IO (hPutStrLn,stderr)
 import FeatureTemplate (parse)
-import Aux.Commands ( CommandSpec (..),defaultMain , usage 
+import Helper.Commands ( CommandSpec (..),defaultMain , usage 
                 , Command
                 , OptDescr(Option), ArgDescr(ReqArg,NoArg))
 import Config(Flags(..))
diff --git a/src/Perceptron/Sequence.hs b/src/Perceptron/Sequence.hs
--- a/src/Perceptron/Sequence.hs
+++ b/src/Perceptron/Sequence.hs
@@ -30,9 +30,9 @@
 import Config 
 import Data.List (inits,foldl',sortBy)
 import Data.Ord (comparing)
-import Aux.ListZipper 
+import Helper.ListZipper 
 import qualified Data.Binary as Binary
-import Aux.Utils (uniq)
+import Helper.Utils (uniq)
 
 data Model = Model { options :: Options 
                    , weights :: UArray I Float }
