diff --git a/ChangeLog b/ChangeLog
new file mode 100644
--- /dev/null
+++ b/ChangeLog
diff --git a/Data/Histogram/Binary.hs b/Data/Histogram/Binary.hs
new file mode 100644
--- /dev/null
+++ b/Data/Histogram/Binary.hs
@@ -0,0 +1,75 @@
+{-# OPTIONS_GHC -fno-warn-orphans       #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+-- | Cereal instances for histogram-fill
+module Data.Histogram.Binary (
+  ) where
+
+import Control.Applicative
+import Data.Binary
+import qualified Data.Vector.Generic as G
+
+import Data.Histogram.Bin
+import Data.Histogram.Bin.MaybeBin
+import Data.Histogram.Generic (Histogram, histogramUO, histData, outOfRange, bins)
+
+
+
+----------------------------------------------------------------
+-- Bins
+----------------------------------------------------------------
+
+instance Binary BinI where
+  get   = binI <$> get <*> get
+  put b = do put (lowerLimit b)
+             put (upperLimit b)
+
+instance Binary BinInt where
+  get   = binIntStep <$> get <*> get <*> get
+  put b = do put (lowerLimit b)
+             put (binSize    b)
+             put (nBins      b)
+
+instance (RealFrac f, Binary f) => Binary (BinF f) where
+  get   = binFstep <$> get <*> get <*> get
+  put b = do put (lowerLimit b)
+             put (binSize    b)
+             put (nBins      b)
+
+instance Binary BinD where
+  get   = binDstep <$> get <*> get <*> get
+  put b = do put (lowerLimit b)
+             put (binSize    b)
+             put (nBins      b)
+
+instance Binary LogBinD where
+   get   = logBinDN <$> get <*> get <*> get
+   put b = do put (lowerLimit       b)
+              put (logBinDIncrement b)
+              put (nBins            b)
+
+instance Binary (BinEnum a) where
+  get = BinEnum <$> get
+  put (BinEnum b) = put b
+
+instance (Binary bX, Binary bY) => Binary (Bin2D bX bY) where
+  get = Bin2D <$> get <*> get
+  put (Bin2D bx by) = put bx >> put by
+
+deriving instance (Binary bin) => Binary (MaybeBin bin)
+
+
+
+----------------------------------------------------------------
+-- Histogram
+----------------------------------------------------------------
+
+instance (Binary a, G.Vector v a, Bin bin, Binary bin
+         ) => Binary (Histogram v bin a) where
+  get = do b  <- get
+           uo <- get
+           v  <- G.replicateM (nBins b) get
+           return $! histogramUO b uo v
+  put h = do put (bins h)
+             put (outOfRange h)
+             G.mapM_ put (histData h)
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c)2009-2012, Aleksey Khudyakov
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of asd nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/histogram-fill-binary.cabal b/histogram-fill-binary.cabal
new file mode 100644
--- /dev/null
+++ b/histogram-fill-binary.cabal
@@ -0,0 +1,32 @@
+Name:           histogram-fill-binary
+Version:        0.6.2.1
+Synopsis:       Binary instances for histogram-fill package
+Description:
+  Binary instances for histogram-fill package
+
+Cabal-Version:  >= 1.6
+License:        BSD3
+License-File:   LICENSE
+Author:         Alexey Khudyakov
+Maintainer:     Alexey Khudyakov <alexey.skladnoy@gmail.com>
+Homepage:       https://github.com/Shimuuar/histogram-fill/
+Category:       Data
+Build-Type:     Simple
+extra-source-files:
+  ChangeLog
+
+source-repository head
+  type:     hg
+  location: http://bitbucket.org/Shimuuar/histogram-fill
+source-repository head
+  type:     git
+  location: http://github.com/Shimuuar/histogram-fill
+
+Library
+  Build-Depends:        base >=3 && <5,
+                        binary,
+                        vector >= 0.7,
+                        histogram-fill >= 0.6
+  Exposed-modules:      Data.Histogram.Binary
+  Ghc-options:          -Wall
+  Ghc-prof-options:     -auto-all
