diff --git a/bytestring-tree-builder.cabal b/bytestring-tree-builder.cabal
--- a/bytestring-tree-builder.cabal
+++ b/bytestring-tree-builder.cabal
@@ -1,52 +1,31 @@
-name:
-  bytestring-tree-builder
-version:
-  0.2.7.3
-category:
-  ByteString
-synopsis:
-  A very efficient ByteString builder implementation based on the binary tree
+name: bytestring-tree-builder
+version: 0.2.7.4
+category: ByteString
+synopsis: A very efficient ByteString builder implementation based on the binary tree
 description:
   According to
   <https://github.com/nikita-volkov/bytestring-builders-benchmark the benchmarks>
   this builder implementation beats all the alternatives.
   It is especially well-suited for generating strict bytestrings,
   beating the standard builder by at least the factor of 4.
-homepage:
-  https://github.com/nikita-volkov/bytestring-tree-builder 
-bug-reports:
-  https://github.com/nikita-volkov/bytestring-tree-builder/issues 
-author:
-  Nikita Volkov <nikita.y.volkov@mail.ru>
-maintainer:
-  Nikita Volkov <nikita.y.volkov@mail.ru>
-copyright:
-  (c) 2015, Nikita Volkov
-license:
-  MIT
-license-file:
-  LICENSE
-build-type:
-  Simple
-cabal-version:
-  >=1.10
-
+homepage: https://github.com/nikita-volkov/bytestring-tree-builder
+bug-reports: https://github.com/nikita-volkov/bytestring-tree-builder/issues
+author: Nikita Volkov <nikita.y.volkov@mail.ru>
+maintainer: Nikita Volkov <nikita.y.volkov@mail.ru>
+copyright: (c) 2015, Nikita Volkov
+license: MIT
+license-file: LICENSE
+build-type: Simple
+cabal-version: >=1.10
 
 source-repository head
-  type:
-    git
-  location:
-    git://github.com/nikita-volkov/bytestring-tree-builder.git
-
+  type: git
+  location: git://github.com/nikita-volkov/bytestring-tree-builder.git
 
 library
-  hs-source-dirs:
-    library
-  ghc-options:
-  default-extensions:
-    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
-  default-language:
-    Haskell2010
+  hs-source-dirs: library
+  default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
+  default-language: Haskell2010
   other-modules:
     ByteString.TreeBuilder.Prelude
     ByteString.TreeBuilder.Poker
@@ -54,62 +33,42 @@
   exposed-modules:
     ByteString.TreeBuilder
   build-depends:
-    semigroups >= 0.18 && < 0.20,
-    bytestring >= 0.10 && < 0.11,
-    text >= 1 && < 2,
-    base-prelude < 2,
-    base >= 4.6 && < 5
-
+    base >=4.6 && <5,
+    base-prelude <2,
+    bytestring >=0.10 && <0.11,
+    semigroups >=0.18 && <0.20,
+    text >=1 && <2
 
 benchmark benchmark
-  type: 
-    exitcode-stdio-1.0
-  hs-source-dirs:
-    benchmark
-  main-is:
-    Main.hs
+  type: exitcode-stdio-1.0
+  hs-source-dirs: benchmark
+  main-is: Main.hs
   ghc-options:
     -O2
     -threaded
     "-with-rtsopts=-N"
     -funbox-strict-fields
-  default-extensions:
-    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveTraversable, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
-  default-language:
-    Haskell2010
+  default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveTraversable, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
+  default-language: Haskell2010
   build-depends:
-    -- 
-    bytestring-tree-builder,
-    -- benchmarking:
-    criterion >= 1.1 && < 2,
-    -- data:
+    base-prelude,
     bytestring,
-    -- general:
-    deepseq == 1.*,
-    base-prelude
-
+    bytestring-tree-builder,
+    criterion >=1.1 && <2,
+    deepseq ==1.*
 
 test-suite tasty
-  type:
-    exitcode-stdio-1.0
-  hs-source-dirs:
-    tasty
-  main-is:
-    Main.hs
-  default-extensions:
-    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
-  default-language:
-    Haskell2010
+  type: exitcode-stdio-1.0
+  hs-source-dirs: tasty
+  main-is: Main.hs
+  default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
+  default-language: Haskell2010
   build-depends:
-    bytestring-tree-builder,
-    -- testing:
-    tasty >= 0.12 && < 2,
-    tasty-quickcheck >= 0.9 && < 0.11,
-    tasty-hunit >= 0.9 && < 0.11,
-    quickcheck-instances >= 0.3.11 && < 0.4,
-    QuickCheck >= 2.8.1 && < 3,
-    -- data:
+    base-prelude,
     bytestring,
-    -- general:
-    base-prelude
-
+    bytestring-tree-builder,
+    QuickCheck >=2.8.1 && <3,
+    quickcheck-instances >=0.3.11 && <0.4,
+    tasty >=0.12 && <2,
+    tasty-hunit >=0.9 && <0.11,
+    tasty-quickcheck >=0.9 && <0.11
diff --git a/library/ByteString/TreeBuilder/Poker.hs b/library/ByteString/TreeBuilder/Poker.hs
--- a/library/ByteString/TreeBuilder/Poker.hs
+++ b/library/ByteString/TreeBuilder/Poker.hs
@@ -34,6 +34,13 @@
 pokeTree :: E.Tree -> D.Ptr Word8 -> IO (D.Ptr Word8)
 pokeTree tree ptr =
   case tree of
-    E.Empty -> pure ptr
     E.Leaf bytes -> pokeBytes bytes ptr
-    E.Branch tree1 tree2 -> pokeTree tree1 ptr >>= pokeTree tree2
+    E.Branch tree1 tree2 -> pokeTreeOnBranch tree1 tree2 ptr
+    E.Empty -> pure ptr
+
+pokeTreeOnBranch :: E.Tree -> E.Tree -> D.Ptr Word8 -> IO (D.Ptr Word8)
+pokeTreeOnBranch a b ptr =
+  case a of
+    E.Branch c d -> pokeTreeOnBranch c (E.Branch d b) ptr
+    E.Leaf bytes -> pokeBytes bytes ptr >>= pokeTree b
+    E.Empty -> pure ptr
