diff --git a/biosff.cabal b/biosff.cabal
--- a/biosff.cabal
+++ b/biosff.cabal
@@ -1,5 +1,5 @@
 Name:                biosff
-Version:             0.2
+Version:             0.3.1
 Synopsis:            Library and executables for working with SFF files
 Description:         The library contains the functionality for reading and writing
 		     SFF files (sequencing data from 454 and Ion Torrent).  It duplicates
@@ -23,8 +23,8 @@
   Tag:      0.2
 
 Library
-  Exposed-modules: Bio.Sequence.SFF
-  Other-modules:   Bio.Sequence.SFF_name, Bio.Sequence.SFF_filters
+  Exposed-modules: Bio.Sequence.SFF, Bio.Sequence.SFF_filters
+  Other-modules:   Bio.Sequence.SFF_name
   Build-depends:   base >= 3 && < 5, biocore >= 0.1, binary, bytestring, array
   Hs-Source-Dirs:  src
   Ghc-Options:     -Wall
diff --git a/src/Bio/Sequence/SFF.hs b/src/Bio/Sequence/SFF.hs
--- a/src/Bio/Sequence/SFF.hs
+++ b/src/Bio/Sequence/SFF.hs
@@ -189,11 +189,13 @@
 -- | Write 'ReadBlock's to a file handle.
 writeReads :: Handle -> Int -> [ReadBlock] -> IO Int32
 writeReads _ _ [] = return 0
-writeReads h i (r:rs) = do
-  LBC.hPut h $ encode (RBI i r)
-  c <- writeReads h i rs
-  return $! (c+1)
-
+writeReads h i xs = go 0 xs
+  where go c (r:rs) = do
+          LBC.hPut h $ encode (RBI i r)
+          let c' = c+1
+          c' `seq` go c' rs
+        go c [] = return c
+        
 data RBI = RBI Int ReadBlock
 
 -- | Wrapper for ReadBlocks since they need additional information
diff --git a/src/Flower/Main.hs b/src/Flower/Main.hs
--- a/src/Flower/Main.hs
+++ b/src/Flower/Main.hs
@@ -20,7 +20,8 @@
 import qualified Data.ByteString.Lazy as L1
 
 import Data.Array.Unboxed
-import Data.Array.ST
+import Data.Array.Unsafe -- unsafeFreeze is deprecated in D.A.ST
+import Data.Array.ST hiding (unsafeFreeze)
 import Control.Monad.ST
 import Control.Monad.State
 
@@ -52,7 +53,7 @@
       on (O.fastq o)     (\h -> mapM_ (L1.hPut h . L1.concat . map toFastQ . tr . rs) =<< inp)
       on (O.summarize o) (\h -> mapM_ (L1.hPut h . summarize . tr . rs) =<< inp)  -- should we trim?
       on (O.filters o)   (\h -> mapM_ (L1.hPut h . sum_filters . rs) =<< inp)
-      on (O.histogram o) (\h -> mapM_ (\(SFF c r) -> hPutStrLn h . showHist 9999 ["A","C","G","T"] . histogram (B.unpack $ flow c) . map flowgram . tr $ r) =<< inp)
+      on (O.histogram o) (\h -> mapM_ (\(SFF c r) -> hPutStrLn h . (case O.plot o of Just str -> showPlot str 1000; Nothing -> showHist 9999)  ["A","C","G","T"] . histogram (B.unpack $ flow c) . map flowgram . tr $ r) =<< inp)
       on (O.histpos o)   (\h -> mapM_ (\(SFF _ r) -> hPutStrLn h . showHist 549 [] . histpos 549 . tr $ r) =<< inp)
       on (O.flowgram o)  (\h -> mapM_ (\(SFF c r) -> L1.hPut h . L1.fromChunks . intersperse (B.pack "\n") . concatMap (showread c) $ r) =<< inp)
 
@@ -239,6 +240,13 @@
   g' <- unsafeFreeze g
   t' <- unsafeFreeze t
   return [a',c',g',t']
+
+-- ouput a histogram in gnuplot format
+showPlot :: String -> Int -> [String] -> [Hist] -> String
+showPlot cmds mx hd hs = "set style data lines\nset logscale y\nset xlabel 'Flow value'\nset ylabel 'Count'\nset xtic 1\n\n"++cmds
+  ++"\n\nplot "
+  ++ concat (intersperse "," [" '-' ti "++show c | c <- hd]) ++ "\n"
+  ++ unlines [ unlines [showFFloat (Just 2) (fromIntegral sc/100::Double) ""++"\t"++show (h!sc) | sc <- [0..fromIntegral mx]] ++ "e\n" | h <- hs]
 
 showHist :: Int -> [String] -> [Hist] -> String
 showHist mx hd hs = (if not (null hd) then concat (intersperse "\t" ("Score":hd)) ++ "\n" else "") ++
diff --git a/src/Flower/Options.hs b/src/Flower/Options.hs
--- a/src/Flower/Options.hs
+++ b/src/Flower/Options.hs
@@ -4,11 +4,12 @@
 
 import System.Console.CmdArgs
 import Control.Monad (when)
-import Data.Maybe (isJust)
+import Data.Maybe (isJust, isNothing)
 
 data Opts = Opts 
             { trimKey :: Bool
             , trim    :: Bool
+            , plot    :: Maybe String
             , summarize :: Maybe FilePath
             , filters :: Maybe FilePath
             , info    :: Maybe FilePath
@@ -38,6 +39,7 @@
   , flowgram = def  &= help "Output flowgram information in tabular form" &= typFile &= name "F" &= optdef
   , histogram = def &= help "Output histogram of flow values by nucleotide" &= typFile &= name "h" &= optdef
   , histpos   = def &= help "Output histogram of flow values by flow cycle" &= typFile &= name "H" &= optdef
+  , plot      = Nothing &= help "Output gnuplot script for visualization" &= opt ""
   , text      = def &= help "Output SFF information as text (default)"    &= typFile &= name "T" &= optdef
   , inputs  = def &= args &= typFile
   } 
@@ -50,5 +52,6 @@
   -- print o
   let outs = filter isJust $ map ($o) [summarize,filters,info,fasta,fqual,fastq,flowgram,histogram,histpos,text]
   when ((length $ filter (==Just "-") $ outs) > 1) $ error "If you specify more than one output format, you need to specify output files"
+  when (isJust (plot o) && isNothing (histogram o)) $ error "Gnuplot output only supported for histograms"
   let o' = if null outs then o { text = Just "-" } else o
   return o'
