Index: tools/Makefile.am
===================================================================
--- tools/Makefile.am	(revision 721)
+++ tools/Makefile.am	(revision 721)
@@ -0,0 +1,17 @@
+EXTRA_DIST += \
+	tools/CMakeLists.txt
+
+if WANT_TOOLS
+
+bin_PROGRAMS += \
+	tools/dimacs-solver \
+	tools/dimacs-to-lgf \
+	tools/lgf-gen
+
+dist_bin_SCRIPTS += tools/lemon-0.x-to-1.x.sh
+
+endif WANT_TOOLS
+
+tools_dimacs_solver_SOURCES = tools/dimacs-solver.cc
+tools_dimacs_to_lgf_SOURCES = tools/dimacs-to-lgf.cc
+tools_lgf_gen_SOURCES = tools/lgf-gen.cc
Index: tools/dimacs-solver.cc
===================================================================
--- tools/dimacs-solver.cc	(revision 956)
+++ tools/dimacs-solver.cc	(revision 1167)
@@ -3,5 +3,5 @@
  * This file is a part of LEMON, a generic C++ optimization library.
  *
- * Copyright (C) 2003-2010
+ * Copyright (C) 2003-2009
  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
  * (Egervary Research Group on Combinatorial Optimization, EGRES).
@@ -89,8 +89,8 @@
   pre.run();
   if(report) std::cerr << "Run Preflow: " << ti << '\n';
-  if(report) std::cerr << "\nMax flow value: " << pre.flowValue() << '\n';
-}
-
-template<class Value, class LargeValue>
+  if(report) std::cerr << "\nMax flow value: " << pre.flowValue() << '\n';  
+}
+
+template<class Value>
 void solve_min(ArgParser &ap, std::istream &is, std::ostream &,
                Value infty, DimacsDescriptor &desc)
@@ -118,16 +118,16 @@
   if (report) std::cerr << "Read the file: " << ti << '\n';
 
-  ti.restart();
-  NetworkSimplex<Digraph, Value> ns(g);
+  typedef NetworkSimplex<Digraph, Value> MCF;
+  ti.restart();
+  MCF ns(g);
   ns.lowerMap(lower).upperMap(cap).costMap(cost).supplyMap(sup);
   if (sum_sup > 0) ns.supplyType(ns.LEQ);
   if (report) std::cerr << "Setup NetworkSimplex class: " << ti << '\n';
   ti.restart();
-  bool res = ns.run();
+  typename MCF::ProblemType res = ns.run();
   if (report) {
     std::cerr << "Run NetworkSimplex: " << ti << "\n\n";
-    std::cerr << "Feasible flow: " << (res ? "found" : "not found") << '\n';
-    if (res) std::cerr << "Min flow cost: "
-                       << ns.template totalCost<LargeValue>() << '\n';
+    std::cerr << "Feasible flow: " << (res == MCF::OPTIMAL ? "found" : "not found") << '\n';
+    if (res) std::cerr << "Min flow cost: " << ns.totalCost() << '\n';
   }
 }
@@ -149,9 +149,9 @@
   if(report) std::cerr << "Run MaxMatching: " << ti << '\n';
   if(report) std::cerr << "\nCardinality of max matching: "
-                       << mat.matchingSize() << '\n';
-}
-
-
-template<class Value, class LargeValue>
+                       << mat.matchingSize() << '\n';  
+}
+
+
+template<class Value>
 void solve(ArgParser &ap, std::istream &is, std::ostream &os,
            DimacsDescriptor &desc)
@@ -167,9 +167,9 @@
       exit(1);
     }
-
+  
   switch(desc.type)
     {
     case DimacsDescriptor::MIN:
-      solve_min<Value, LargeValue>(ap,is,os,infty,desc);
+      solve_min<Value>(ap,is,os,infty,desc);
       break;
     case DimacsDescriptor::MAX:
@@ -188,7 +188,4 @@
 
 int main(int argc, const char *argv[]) {
-  typedef SmartDigraph Digraph;
-
-  typedef Digraph::Arc Arc;
 
   std::string inputName;
@@ -239,5 +236,5 @@
 
   DimacsDescriptor desc = dimacsType(is);
-
+  
   if(!ap.given("q"))
     {
@@ -264,16 +261,14 @@
       std::cout << "\n\n";
     }
-
+    
   if(ap.given("double"))
-    solve<double, double>(ap,is,os,desc);
+    solve<double>(ap,is,os,desc);
   else if(ap.given("ldouble"))
-    solve<long double, long double>(ap,is,os,desc);
+    solve<long double>(ap,is,os,desc);
 #ifdef LEMON_HAVE_LONG_LONG
   else if(ap.given("long"))
-    solve<long long, long long>(ap,is,os,desc);
-  else solve<int, long long>(ap,is,os,desc);
-#else
-  else solve<int, long>(ap,is,os,desc);
+    solve<long long>(ap,is,os,desc);
 #endif
+  else solve<int>(ap,is,os,desc);
 
   return 0;
Index: tools/lemon-0.x-to-1.x.sh
===================================================================
--- tools/lemon-0.x-to-1.x.sh	(revision 738)
+++ tools/lemon-0.x-to-1.x.sh	(revision 621)
@@ -36,8 +36,8 @@
         -e "s/Edge\>/_Ar_c_label_/g"\
         -e "s/\<edge\>/_ar_c_label_/g"\
-        -e "s/_edge\>/__ar_c_label_/g"\
+        -e "s/_edge\>/_ar_c_label_/g"\
         -e "s/Edges\>/_Ar_c_label_s/g"\
         -e "s/\<edges\>/_ar_c_label_s/g"\
-        -e "s/_edges\>/__ar_c_label_s/g"\
+        -e "s/_edges\>/_ar_c_label_s/g"\
         -e "s/\([Ee]\)dge\([a-z]\)/_\1d_ge_label_\2/g"\
         -e "s/\([a-z]\)edge/\1_ed_ge_label_/g"\
@@ -69,9 +69,4 @@
         -e "s/_GR_APH_TY_PEDE_FS_label_/GRAPH_TYPEDEFS/g"\
         -e "s/_DIGR_APH_TY_PEDE_FS_label_/DIGRAPH_TYPEDEFS/g"\
-        -e "s/\<digraph_adaptor\.h\>/adaptors.h/g"\
-        -e "s/\<digraph_utils\.h\>/core.h/g"\
-        -e "s/\<digraph_reader\.h\>/lgf_reader.h/g"\
-        -e "s/\<digraph_writer\.h\>/lgf_writer.h/g"\
-        -e "s/\<topology\.h\>/connectivity.h/g"\
         -e "s/DigraphToEps/GraphToEps/g"\
         -e "s/digraphToEps/graphToEps/g"\
