diff --git a/R-pandoc.cabal b/R-pandoc.cabal
--- a/R-pandoc.cabal
+++ b/R-pandoc.cabal
@@ -1,5 +1,5 @@
 name: R-pandoc
-version: 0.1
+version: 0.2
 cabal-version: >=1.10
 build-type: Simple
 license: BSD3
@@ -34,7 +34,7 @@
     build-depends:
         base         >=4.6  && <4.9,
         pandoc-types >=1.12 && <1.13,
-        R-pandoc     ==0.1
+        R-pandoc     ==0.2
     main-is: src/Main.hs
     buildable: True
     default-language: Haskell2010
diff --git a/src/Main.hs b/src/Main.hs
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -2,4 +2,4 @@
 import           Text.Pandoc.R
 
 main :: IO ()
-main = toJSONFilter (insertRplots "plots")
+main = toJSONFilter (insertRplots "plots" False)
diff --git a/src/Text/Pandoc/R.hs b/src/Text/Pandoc/R.hs
--- a/src/Text/Pandoc/R.hs
+++ b/src/Text/Pandoc/R.hs
@@ -15,30 +15,44 @@
 import           Text.Pandoc.Generic
 import           Text.Pandoc.JSON
 
-rClass, fileAttr, defFile, defRplot, tmpRFile :: String
+rClass, defFile, defRplot, tmpRFile :: String
 rClass = "Rplot"
-fileAttr = "files"
 defFile = "Rplot.png"
 defRplot = "Rplots.pdf"
 tmpRFile = "plot.R"
 
-renderRPandoc :: FilePath -> Pandoc -> IO Pandoc
-renderRPandoc f p = bottomUpM (insertRplots f) p
+data Echo = Above | Below
+   deriving (Read, Show)
 
-insertRplots :: FilePath -> Block -> IO Block
-insertRplots outDir block@(CodeBlock (ident, classes, attrs) code) = do
-   --hPutStrLn stderr $ "insertRplots classes: " ++ (show classes) ++ " attrs: " ++ (show attrs) ++ " ident: " ++ (show ident)
-   if rClass `elem` classes then do
-      let imgFiles = case lookup fileAttr attrs of
-           Just is -> splitOn "," is
-           Nothing   -> [defFile]
-      d <- renderRPlot code
-      when (imgFiles == [defFile]) $ void $ convertDefault
-      imgFiles' <- moveFiles imgFiles outDir
-      return $ if d then Plain (map insertImage imgFiles') else block
-   else return block
-insertRplots _ block = return block
+renderRPandoc :: FilePath -> Bool -> Pandoc -> IO Pandoc
+renderRPandoc f absolutePath p = bottomUpM (insertRplots f absolutePath) p
 
+insertRplots :: FilePath -> Bool -> Block -> IO Block
+insertRplots outDir absolutePath block@(CodeBlock (ident, classes, attrs) code) | rClass `elem` classes = do
+   let imgFiles = readImgFiles attrs
+   d <- renderRPlot code
+   when (imgFiles == [defFile]) $ void $ convertDefault
+   moveFiles imgFiles outDir
+   let imgFiles' = map ((if absolutePath then pathSeparator : outDir else outDir) </>) imgFiles
+   let imgBlock = Plain (map insertImage imgFiles')
+   let codeBlock = CodeBlock (ident, "r":delete "Rplot" classes, attrs) code
+   let block' = case readEcho attrs of
+        (Just Above) -> Table [] [AlignLeft] [] [] [[[codeBlock]], [[imgBlock]]]
+        (Just Below) -> Table [] [AlignLeft] [] [] [[[imgBlock]], [[codeBlock]]]
+        Nothing -> imgBlock
+   return $ if d then block' else block
+insertRplots _ _ block = return block
+
+readEcho :: [(String, String)] -> Maybe Echo
+readEcho attrs = case lookup "echo" attrs of
+   Just e  -> Just (read e)
+   Nothing -> Nothing
+
+readImgFiles :: [(String, String)] -> [FilePath]
+readImgFiles attrs = case lookup "files" attrs of
+   Just is -> splitOn "," is
+   Nothing -> [defFile]
+
 insertImage :: FilePath -> Inline
 insertImage file = Image [] (file,"")
 
@@ -58,11 +72,11 @@
    whenM (doesFileExist "plot.Rout") $ removeFile "plot.Rout"
    return $ (code==ExitSuccess)
 
-moveFiles :: [FilePath] -> FilePath -> IO [FilePath]
+moveFiles :: [FilePath] -> FilePath -> IO ()
 moveFiles files outDir = do
    createDirectoryIfMissing False outDir
    mapM_ (\a -> whenM (doesFileExist a) $ renameFile a (outDir </> a)) files
-   return $ map ((pathSeparator : outDir) </>) files
+
 
 convertDefault :: IO Bool
 convertDefault = do
