diff --git a/include/hpp/manipulation/graph-optimizer.hh b/include/hpp/manipulation/graph-optimizer.hh
index 13514642a30783c2f45a051b327ac50bc039db73..752fbf0c84a82efdff3e8eb43d27cc023128d0bf 100644
--- a/include/hpp/manipulation/graph-optimizer.hh
+++ b/include/hpp/manipulation/graph-optimizer.hh
@@ -71,11 +71,6 @@ namespace hpp {
 
         /// The encapsulated PathOptimizer
         PathOptimizerPtr_t pathOptimizer_;
-
-        /// Append all paths of in to out
-        /// \param in a path vector, possibly containing other path vector
-        /// \param out a flat PathVector (do not contain PathVector)
-        static void unpack (PathVectorPtr_t in, PathVectorPtr_t out);
     };
     /// \}
 
diff --git a/src/graph-optimizer.cc b/src/graph-optimizer.cc
index 39723180d4b1c9a8625ff1ab2419dd3a9aaec7e8..fce049ee7468385d5b06ae0e4ccaa680800274d4 100644
--- a/src/graph-optimizer.cc
+++ b/src/graph-optimizer.cc
@@ -31,7 +31,7 @@ namespace hpp {
       GraphPathValidationPtr_t gpv = HPP_DYNAMIC_PTR_CAST (GraphPathValidation,
               this->problem().pathValidation ());
       const_cast <core::Problem&>(this->problem ()).pathValidation (gpv->innerValidation());
-      unpack (path, expanded);
+      path->flatten (expanded);
       ConstraintSetPtr_t c;
       for (std::size_t i_s = 0; i_s < expanded->numberPaths ();) {
         PathVectorPtr_t toOpt = PathVector::create (
@@ -58,18 +58,5 @@ namespace hpp {
       const_cast <core::Problem&>(this->problem ()).pathValidation (gpv);
       return opted;
     }
-
-    void GraphOptimizer::unpack (PathVectorPtr_t in, PathVectorPtr_t out)
-    {
-      for (size_t i = 0; i != in->numberPaths (); i++) {
-        PathPtr_t current = in->pathAtRank (i);
-        PathVectorPtr_t pv = HPP_DYNAMIC_PTR_CAST (PathVector, current);
-        if (pv) {
-          unpack (pv, out);
-        } else {
-          out->appendPath (current);
-        }
-      }
-    }
   } // namespace manipulation
 } // namespace hpp