diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 Naïm Favier
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-misfortune ![Build Status](https://travis-ci.org/mokus0/misfortune.png)
+misfortune
 ===========
 
 This is a fortune-mod clone.  In addition to the features generally expected of a `fortune` program, this can be used as a Haskell library (`import Data.Fortune`) and also supports UTF-8 fortune files, configurable search paths, automatic merging of fortune databases with the same name (so you can have a local fortunes folder that just adds to existing fortune databases), filtering fortunes by line lengths, and a "print fortune matching regex" mode (instead of just "print all fortunes matching regex" mode).
@@ -40,7 +40,7 @@
 
 Or build the latest version from git:
 
-    git clone https://github.com/mokus0/misfortune.git
+    git clone https://github.com/ncfavier/misfortune
     cd misfortune
     cabal install
 
diff --git a/misfortune.cabal b/misfortune.cabal
--- a/misfortune.cabal
+++ b/misfortune.cabal
@@ -1,19 +1,28 @@
+cabal-version:          3.0
 name:                   misfortune
-version:                0.1.1.2
+version:                0.1.2
 stability:              experimental
 
-cabal-version:          >= 1.6
-build-type:             Simple
-
 author:                 James Cook <mokus@deepbondi.net>
-maintainer:             James Cook <mokus@deepbondi.net>
-license:                PublicDomain
-homepage:               https://github.com/mokus0/misfortune
+maintainer:             Naïm Favier <n@monade.li>
+license:                MIT
+license-file:           LICENSE
+homepage:               https://github.com/ncfavier/misfortune
 
 category:               Console, Game
 synopsis:               fortune-mod clone
 description:            fortune-mod clone, in library and executable form.
 
+tested-with:            GHC == 7.0.4,
+                        GHC == 7.2.2,
+                        GHC == 7.4.2,
+                        GHC == 7.6.3,
+                        GHC == 7.8.4,
+                        GHC == 7.10.1,
+                        GHC == 7.11,
+                        GHC == 8.10.7,
+                        GHC == 9.0.2
+
 data-files:             README.md
                         README.fortune-mod.md
                         README.lambdabot.md
@@ -97,38 +106,40 @@
 
 source-repository head
   type:                 git
-  location:             https://github.com/mokus0/misfortune.git
+  location:             https://github.com/ncfavier/misfortune
 
-Library
+common main
+  default-language:     Haskell2010
   hs-source-dirs:       src
   ghc-options:          -fwarn-unused-binds -fwarn-unused-imports
-  exposed-modules:      Data.Fortune
   other-modules:        Data.Fortune.FortuneFile
                         Data.Fortune.Index
                         Data.Fortune.Stats
                         Paths_misfortune
+  autogen-modules:      Paths_misfortune
   build-depends:        base >= 3 && < 5,
                         bytestring,
                         cereal,
                         directory,
                         filepath,
                         knob,
-                        random-fu >= 0.2.2,
-                        semigroups,
+                        random,
+                        random-fu >= 0.3,
                         text,
                         utf8-string,
                         vector
+  if impl(ghc == 7.0.*)
+    -- utf8-string-1.0.1 does not build on GHC 7.0.x
+    build-depends:      utf8-string == 1
 
-Executable misfortune
-  hs-source-dirs:       src
-  ghc-options:          -fwarn-unused-binds -fwarn-unused-imports
+library
+  import:               main
+  exposed-modules:      Data.Fortune
+
+executable misfortune
+  import:               main
   main-is:              Fortune.hs
+  other-modules:        Data.Fortune
   build-depends:        monad-loops,
                         regex-base,
                         regex-pcre
-
-Executable misfortune-strfile
-  hs-source-dirs:       src
-  ghc-options:          -fwarn-unused-binds -fwarn-unused-imports
-  main-is:              StrFile.hs
-
diff --git a/src/Data/Fortune.hs b/src/Data/Fortune.hs
--- a/src/Data/Fortune.hs
+++ b/src/Data/Fortune.hs
@@ -48,7 +48,6 @@
 import Data.Fortune.Index
 import qualified Data.Fortune.Stats as S
 
-import Control.Applicative
 import Control.Exception
 import Control.Monad
 import Data.Char
@@ -64,6 +63,7 @@
 import System.Directory
 import System.Environment
 import System.FilePath
+import System.Random.Stateful (newIOGenM, newStdGen)
 
 -- |The number of fortune strings in the index
 numFortunes :: S.FortuneStats -> Int
@@ -233,9 +233,10 @@
 -- random fortune from that file (unformly).
 randomFortuneFromRandomFile :: RVar FortuneFile -> IO String
 randomFortuneFromRandomFile file = do
-    f <- sample file
+    gen <- newStdGen >>= newIOGenM
+    f <- sampleFrom gen file
     n <- getNumFortunes f
-    i <- sample (uniform 0 (n-1))
+    i <- sampleFrom gen (uniform 0 (n-1))
     T.unpack <$> getFortune f i
 
 -- |Given a list of 'FortuneFile's, compute a distrubution over them weighted by the number
diff --git a/src/Data/Fortune/FortuneFile.hs b/src/Data/Fortune/FortuneFile.hs
--- a/src/Data/Fortune/FortuneFile.hs
+++ b/src/Data/Fortune/FortuneFile.hs
@@ -15,7 +15,6 @@
      , appendFortune
      ) where
 
-import Control.Applicative
 import Control.Concurrent
 import Control.Exception
 import Control.Monad
diff --git a/src/Data/Fortune/Index.hs b/src/Data/Fortune/Index.hs
--- a/src/Data/Fortune/Index.hs
+++ b/src/Data/Fortune/Index.hs
@@ -54,12 +54,10 @@
      , rebuildStats
      ) where
 
-import Control.Applicative
 import Control.Concurrent.MVar
 import Control.Exception
 import Control.Monad
 import qualified Data.ByteString as BS
-import Data.Foldable (foldMap)
 import Data.Fortune.Stats
 import Data.Knob
 import Data.Maybe
diff --git a/src/Fortune.hs b/src/Fortune.hs
--- a/src/Fortune.hs
+++ b/src/Fortune.hs
@@ -2,7 +2,6 @@
 {-# LANGUAGE FlexibleContexts #-}
 module Main (main) where
 
-import Control.Applicative
 import Control.Monad
 import Control.Monad.Loops
 import Data.Either
@@ -21,6 +20,7 @@
 import System.Exit
 import System.FilePath
 import System.IO
+import System.Random.Stateful (newIOGenM, newStdGen)
 import Text.Printf
 import Text.Regex.Base
 import Text.Regex.PCRE
@@ -200,6 +200,7 @@
     fortunes <- filterM (filterFile args) (fortuneFiles args)
     
     dist <- getDist args fortunes
+    gen <- newStdGen >>= newIOGenM
     
     when (numEvents dist == 0) $ do
         hPutStrLn stderr "No fortunes matched the filter criteria"
@@ -225,8 +226,8 @@
             , let pctStr = printf "(%.2f%%)" (100 * weight / totalWeight dist) :: String
             ]
         else do
-            (file, fortuneDist) <- sample dist
-            fortune <- sample fortuneDist
+            (file, fortuneDist) <- sampleFrom gen dist
+            fortune <- sampleFrom gen fortuneDist
             putStrLn . T.unpack =<< getFortune file fortune
 
 getDist :: Args -> [FortuneFile] -> IO (Categorical Float (FortuneFile, Categorical Float Int))
diff --git a/src/StrFile.hs b/src/StrFile.hs
deleted file mode 100644
--- a/src/StrFile.hs
+++ /dev/null
@@ -1,13 +0,0 @@
-module Main where
-
-import Data.Fortune
-import System.Environment
-
-main = do
-    args <- getArgs
-    mapM_ index args
-
-index file = do
-    fortune <- openFortuneFile '%' True file
-    rebuildIndex fortune
-    
