diff --git a/Chapter12.hs b/Chapter12.hs
--- a/Chapter12.hs
+++ b/Chapter12.hs
@@ -53,10 +53,11 @@
 
 type RegExp = String -> Bool
 
-char :: Char -> RegExp
 
+epsilon :: RegExp
 epsilon = (=="")
 
+char :: Char -> RegExp
 char ch = (==[ch])
 
 (|||) :: RegExp -> RegExp ->  RegExp
@@ -64,27 +65,59 @@
 e1 ||| e2 = 
     \x -> e1 x || e2 x
 
-(<*>) :: RegExp -> RegExp ->  RegExp
+(<++>) :: RegExp -> RegExp ->  RegExp
 
-e1 <*> e2 =
+e1 <++> e2 =
     \x -> or [ e1 y && e2 z | (y,z) <- splits x ]
 
-(<**>) :: RegExp -> RegExp ->  RegExp
+(<+++>) :: RegExp -> RegExp ->  RegExp
 
-e1 <**> e2 =
+e1 <+++> e2 =
     \x -> or [ e1 y && e2 z | (y,z) <- fsplits x ]
 
+splits :: [a] -> [([a], [a])]
+
 splits xs = [splitAt n xs | n<-[0..len]]
     where
       len = length xs
 
 star :: RegExp -> RegExp
 
-star p = epsilon ||| (p <**> star p)
---           epsilon ||| (p <*> star p)
+star p = epsilon ||| (p <+++> star p)
+--           epsilon ||| (p <++> star p)
 -- is OK as long as p can't have epsilon match
 
-fsplits xs = tail (splits xs)
+fsplits :: [a] -> [([a], [a])]
+
+fsplits = tail . splits
+
+-- Regular expressions as data
+
+data RE =
+  Epsilon |
+  Chr Char |
+  Or RE RE |
+  Seq RE RE |
+  Star RE
+  deriving (Show,Eq)
+
+-- Interpreting REs as functions i.e. RegExps
+
+match :: RE -> RegExp
+match Epsilon    = epsilon
+match (Chr c)    = char c
+match (Or e f)   = match e ||| match f
+match (Seq e f)  = match e <++> match f
+match (Star e)   = star (match e)
+
+-- Simplifying REs …
+
+simplify :: RE -> RE
+simplify (Seq Epsilon e) = e
+simplify (Seq e Epsilon) = e
+simplify (Star (Star e)) = Star e
+  -- can add more cases here …
+simplify x = x
 
 --
 -- Case studies: functions as data
diff --git a/Chapter19/ParseLib.hs b/Chapter19/ParseLib.hs
--- a/Chapter19/ParseLib.hs
+++ b/Chapter19/ParseLib.hs
@@ -123,8 +123,11 @@
 
 instance Monad (SParse a) where
   return x = SParse (succeed x)
-  (SParse pr) >>= f 
+  (SParse pr) >>= f
     = SParse (\st -> concat [ sparse (f a) rest | (a,rest) <- pr st ])
+
+instance MonadFail (SParse a) where
+  fail s   = SParse none
 
 instance Applicative (SParse a) where
   pure = return
diff --git a/Craft3e.cabal b/Craft3e.cabal
--- a/Craft3e.cabal
+++ b/Craft3e.cabal
@@ -1,6 +1,6 @@
 
 name: Craft3e
-version: 0.2.0.2
+version: 0.2.0.3
 license: MIT
 license-file: LICENSE
 copyright: (c) Addison Wesley
@@ -46,6 +46,7 @@
     open-browser >= 0.1.0.0 && < 0.5.0.0
   
   exposed-modules:
+
     Chapter1
     Chapter10
     Chapter11
@@ -113,9 +114,6 @@
     RandomGen
     ServerState
     TopLevelServe  
-
-  other-modules:
-
 
   hs-source-dirs: . ./Calculator ./Chapter15 ./Chapter16 ./Chapter19 ./Simulation  ./Chapter20
 
diff --git a/ParseLib.hs b/ParseLib.hs
--- a/ParseLib.hs
+++ b/ParseLib.hs
@@ -123,8 +123,11 @@
 
 instance Monad (SParse a) where
   return x = SParse (succeed x)
-  (SParse pr) >>= f 
+  (SParse pr) >>= f
     = SParse (\st -> concat [ sparse (f a) rest | (a,rest) <- pr st ])
+
+instance MonadFail (SParse a) where
+  fail s   = SParse none
 
 instance Applicative (SParse a) where
   pure = return
diff --git a/Pictures.hs b/Pictures.hs
--- a/Pictures.hs
+++ b/Pictures.hs
@@ -62,6 +62,7 @@
 
 printPicture = putStr . concat . map (++"\n")
 
+render = printPicture
 
 -- Transformations of pictures.
 -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -70,7 +71,7 @@
 
 flipV :: Picture -> Picture
 
-flipV = map reverse
+flipV pic = map reverse pic
 
 -- Reflection in a horizontal mirror.
 
@@ -98,14 +99,14 @@
 
 beside :: Picture -> Picture -> Picture
 
-beside = zipWith (++)
+beside pic1 pic2 = zipWith (++) pic1 pic2
 
 -- Superimose one picture above another. Assume the pictures to be the same
 -- size. The individual characters are combined using the combine function.
 
 superimpose :: Picture -> Picture -> Picture
 
-superimpose = zipWith (zipWith combine)
+superimpose pic1 pic2 = zipWith (zipWith combine) pic1 pic2
 
 -- For the result to be '.' both components have to the '.'; otherwise
 -- get the '#' character.
@@ -121,7 +122,7 @@
 
 invertColour :: Picture -> Picture
 
-invertColour = map (map invert)
+invertColour pic = map (map invert) pic
 
 -- ... which works by making the result '.' unless the input is '.'.
 
diff --git a/Test.hs b/Test.hs
--- a/Test.hs
+++ b/Test.hs
@@ -16,3 +16,63 @@
 
 pic2 :: Picture
 pic2 = pic1 `above` invert pic1
+
+howManyEqual :: Integer -> Integer -> Integer -> Integer
+
+howManyEqual x y z 
+  | x==y && y==z            = 3
+  | x==y || y==z || z==x    = 2
+  | otherwise               = 0
+
+
+(^^^) :: Integer -> Integer -> Integer
+x ^^^ y 
+    | x>= y      = x
+    | otherwise  = y
+
+fac :: Integer -> Integer
+
+fac 0               = 1
+fac n 
+    | n>0           = n * fac (n-1)
+    | otherwise     = 0
+
+
+
+maxThreeOccurs :: Integer -> Integer -> Integer -> (Integer,Integer)
+
+maxThreeOccurs x y z =
+  (theMax,occurs)
+  where
+    theMax = max (max x y) z
+    occurs = eq x + eq y + eq z
+    eq w = if w==theMax then 1 else 0
+
+pow :: Integer -> Integer
+
+pow n 
+  | n==0      = 1
+  | n>0       = 2 * pow (n-1) 
+  | otherwise = 0      
+
+sumFun :: (Integer -> Integer) -> Integer -> Integer
+  
+sumFun f n 
+  | n==0      = f 0
+  | n>0       = sumFun f (n-1) + f n
+  | otherwise = 0  
+
+
+fibP :: Integer -> (Integer,Integer)
+
+fibP 0 = (0,1)
+fibP n = (v,u+v)
+         where
+         (u,v) = fibP (n-1)
+
+
+fib :: Integer -> Integer
+
+fib 0 = 0
+fib 1 = 1
+fib n = fib (n-2) + fib (n-1)
diff --git a/svgOut.xml b/svgOut.xml
--- a/svgOut.xml
+++ b/svgOut.xml
@@ -9,9 +9,5 @@
 
   <image x="150" y="0" width="150" height="200" xlink:href="blk_horse_head.jpg" transform="translate(450,0) scale(-1,1)"  filter="url(#negative)"/>
 
-  <image x="0" y="200" width="150" height="200" xlink:href="blk_horse_head.jpg" filter="url(#negative)"/>
-
-  <image x="150" y="200" width="150" height="200" xlink:href="blk_horse_head.jpg" transform="translate(450,0) scale(-1,1)" />
-
 </svg>
 
