diff --git a/hoodle-render.cabal b/hoodle-render.cabal
--- a/hoodle-render.cabal
+++ b/hoodle-render.cabal
@@ -1,5 +1,5 @@
 Name:		hoodle-render
-Version:	0.3
+Version:	0.3.1
 Synopsis:       Hoodle file renderer
 Description: 	Rendering library using cairo for hoodle file format
 License: 	BSD3
@@ -14,10 +14,6 @@
   type: git
   location: http://www.github.com/wavewave/hoodle-render
 
--- Flag Poppler
---   Description: Enable poppler support
---   Default:     False
-
 Library
   hs-source-dirs: src
   ghc-options: 	-Wall -fno-warn-orphans -funbox-strict-fields -fno-warn-unused-do-bind
@@ -39,13 +35,8 @@
                  unix >= 2.5,
                  uuid >= 1.2, 
                  monad-loops >= 0.3,  
-                 -- hoodle-common >= 0.1,
                  poppler >= 0.12.2.2
 
---   if flag(poppler)
---    Build-Depends: poppler >= 0.12.2.2
---  else 
---     Build-Depends: 
 
   Exposed-Modules: 
                    Graphics.Hoodle.Render 
@@ -65,5 +56,3 @@
                    Graphics.Hoodle.Render.Util.HitTest
                    Hoodle.Util.Process
 
---  if flag(poppler)
---    cpp-options: -DPOPPLER
diff --git a/src/Graphics/Hoodle/Render/Background.hs b/src/Graphics/Hoodle/Render/Background.hs
--- a/src/Graphics/Hoodle/Render/Background.hs
+++ b/src/Graphics/Hoodle/Render/Background.hs
@@ -24,8 +24,11 @@
 import           Data.ByteString.Base64 
 import qualified Data.ByteString.Char8 as C
 import           Data.Monoid
+import           Data.UUID.V4 (nextRandom)
 import qualified Graphics.UI.Gtk.Poppler.Document as Poppler
 import qualified Graphics.UI.Gtk.Poppler.Page as PopplerPage
+import           System.Directory
+import           System.FilePath ((</>),(<.>))
 -- from hoodle-platform
 import           Data.Hoodle.BBox
 import           Data.Hoodle.Predefined 
@@ -65,8 +68,13 @@
   case mdecoded of 
     Nothing -> return Nothing 
     Just decoded -> do 
-      C.writeFile "/tmp/popplertest.pdf" decoded 
-      popplerGetDocFromFile "/tmp/popplertest.pdf"
+      uuidstr <- liftM show nextRandom
+      tmpdir <- getTemporaryDirectory 
+      let tmpfile = tmpdir </> uuidstr <.> "pdf" 
+      C.writeFile tmpfile decoded 
+      mdoc <- popplerGetDocFromFile (C.pack tmpfile)
+      removeFile tmpfile 
+      return mdoc 
 
 
 -- |
diff --git a/src/Graphics/Hoodle/Render/Highlight.hs b/src/Graphics/Hoodle/Render/Highlight.hs
--- a/src/Graphics/Hoodle/Render/Highlight.hs
+++ b/src/Graphics/Hoodle/Render/Highlight.hs
@@ -60,24 +60,8 @@
 renderRItemHltd :: RItem -> Render ()
 renderRItemHltd (RItemStroke strk) = renderStrkHltd strk
 renderRItemHltd (RItemImage img _) = renderBBoxHltd img
-{-  setSourceRGBA 0 0 0 1
-  setLineWidth 10 
-  let BBox (x1,y1) (x2,y2) = getBBox img
-  rectangle x1 y1 (x2-x1) (y2-y1)
-  stroke -}
 renderRItemHltd (RItemSVG svg _) = renderBBoxHltd svg 
-{-  setSourceRGBA 0 0 0 1
-  setLineWidth 10 
-  let BBox (x1,y1) (x2,y2) = getBBox svg
-  rectangle x1 y1 (x2-x1) (y2-y1)
-  stroke -}
 renderRItemHltd (RItemLink lnk _) = renderBBoxHltd lnk
-{-  setSourceRGBA 0 0 0 1
-  setLineWidth 10 
-  let BBox (x1,y1) (x2,y2) = getBBox lnk
-  rectangle x1 y1 (x2-x1) (y2-y1)
-  stroke -}
-
 
 -- |
 renderBBoxHltd :: (GetBBoxable a) => a -> Render () 
diff --git a/src/Graphics/Hoodle/Render/Type/HitTest.hs b/src/Graphics/Hoodle/Render/Type/HitTest.hs
--- a/src/Graphics/Hoodle/Render/Type/HitTest.hs
+++ b/src/Graphics/Hoodle/Render/Type/HitTest.hs
@@ -16,7 +16,7 @@
 
 module Graphics.Hoodle.Render.Type.HitTest where
 
-
+import Control.Applicative
 -- 
 import Data.Hoodle.BBox
 import Data.Hoodle.Simple
@@ -84,3 +84,47 @@
 -- |
 isAnyHitted :: AlterList x (Hitted a) -> Bool 
 isAnyHitted = not . null . takeHitted
+
+
+-- | 
+takeFirstFromHitted :: RItemHitted -> RItemHitted 
+takeFirstFromHitted Empty = Empty 
+takeFirstFromHitted (a :- Empty ) = (a :- Empty )
+takeFirstFromHitted (a :- b :- xs ) = 
+  let (b1,bs) = splitAt 1 (unHitted b) 
+      rs = concat $ interleave unNotHitted unHitted xs   
+  in a :- Hitted b1 :- NotHitted (bs ++ rs) :- Empty
+     
+-- | 
+takeLastFromHitted :: RItemHitted -> RItemHitted 
+takeLastFromHitted Empty = Empty 
+takeLastFromHitted (a :- Empty ) = (a :- Empty )
+takeLastFromHitted (a :- b :- Empty ) = 
+    let b' = unHitted b
+    in if (not.null) b'
+       then let (bs,b1) = (,) <$> init <*> last $ b'
+            in NotHitted (unNotHitted a ++ bs) :- Hitted [b1] :- Empty
+       else NotHitted (unNotHitted a ++ b') :- Empty 
+takeLastFromHitted (a1 :- b :- a2 :- Empty ) = 
+    let b' = unHitted b  
+    in if (not.null) b' 
+       then let (bs,b1) = (,) <$> init <*> last $ b'
+            in NotHitted (unNotHitted a1 ++ bs) :- Hitted [b1] :- a2 :- Empty 
+       else NotHitted (unNotHitted a1 ++ b' ++ unNotHitted a2) :- Empty
+takeLastFromHitted (a :- b :- xs ) = 
+  let xs' = takeLastFromHitted xs 
+  in case xs' of 
+       Empty ->       let b' = unHitted b
+                      in if (not.null) b'
+                         then let (bs,b1) = (,) <$> init <*> last $ b'
+                              in NotHitted (unNotHitted a ++ bs) :- Hitted [b1] :- Empty
+                          else NotHitted (unNotHitted a ++ b') :-  Empty
+       a' :- Empty -> let b' = unHitted b
+                      in if (not.null) b'
+                         then let (bs,b1) = (,) <$> init <*> last $ b'
+                              in NotHitted (unNotHitted a ++ bs) :- Hitted [b1] :- a' :- Empty
+                         else NotHitted (unNotHitted a ++ b' ++ unNotHitted a') :-  Empty 
+       a' :- b' :- xs'' -> NotHitted (unNotHitted a ++ unHitted b ++ unNotHitted a') :- b' :- xs''
+
+       
+     
