Index: src/work/bfs_iterator.h
===================================================================
--- src/work/bfs_iterator.h	(revision 260)
+++ src/work/bfs_iterator.h	(revision 279)
@@ -797,5 +797,7 @@
       actual_node=s;
       reached.set(s, true);
-      dfs_stack.push(G.template first<OutEdgeIt>(s)); 
+      OutEdgeIt e;
+      G.first(e, s);
+      dfs_stack.push(e); 
     }
     DfsIterator5<GraphWrapper, /*OutEdgeIt,*/ ReachedMap>& 
@@ -807,5 +809,7 @@
 	actual_node=w;
 	if (!reached.get(w)) {
-	  dfs_stack.push(G.template first<OutEdgeIt>(w));
+	  OutEdgeIt e;
+	  G.first(e, w);
+	  dfs_stack.push(e);
 	  reached.set(w, true);
 	  b_node_newly_reached=true;
Index: src/work/edmonds_karp.h
===================================================================
--- src/work/edmonds_karp.h	(revision 269)
+++ src/work/edmonds_karp.h	(revision 279)
@@ -353,6 +353,9 @@
       FilterResGW filter_res_graph(res_graph, dist);
       typename ResGW::NodeMap<typename MG::Node> res_graph_to_F(res_graph);
-      for(typename ResGW::NodeIt n=res_graph.template first<typename ResGW::NodeIt>(); res_graph.valid(n); res_graph.next(n)) {
-	res_graph_to_F.set(n, F.addNode());
+      {
+	typename ResGW::NodeIt n;
+	for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) {
+	  res_graph_to_F.set(n, F.addNode());
+	}
       }
 
@@ -364,6 +367,8 @@
       //Making F to the graph containing the edges of the residual graph 
       //which are in some shortest paths
-      for(typename FilterResGW::EdgeIt e=filter_res_graph.template first<typename FilterResGW::EdgeIt>(); filter_res_graph.valid(e); filter_res_graph.next(e)) {
-	//if (dist.get(res_graph.head(e))==dist.get(res_graph.tail(e))+1) {
+      {
+	typename FilterResGW::EdgeIt e;
+	for(filter_res_graph.first(e); filter_res_graph.valid(e); filter_res_graph.next(e)) {
+	  //if (dist.get(res_graph.head(e))==dist.get(res_graph.tail(e))+1) {
 	  typename MG::Edge f=F.addEdge(res_graph_to_F.get(res_graph.tail(e)), res_graph_to_F.get(res_graph.head(e)));
 	  original_edge.update();
@@ -372,4 +377,5 @@
 	  residual_capacity.set(f, res_graph.resCap(e));
 	  //} 
+	}
       }
 
@@ -447,6 +453,9 @@
       MG F;
       typename ResGW::NodeMap<typename MG::Node> res_graph_to_F(res_graph);
-      for(typename ResGW::NodeIt n=res_graph.template first<typename ResGW::NodeIt>(); res_graph.valid(n); res_graph.next(n)) {
-	res_graph_to_F.set(n, F.addNode());
+      {
+	typename ResGW::NodeIt n;
+	for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) {
+	  res_graph_to_F.set(n, F.addNode());
+	}
       }
 
Index: src/work/iterator_bfs_demo.cc
===================================================================
--- src/work/iterator_bfs_demo.cc	(revision 265)
+++ src/work/iterator_bfs_demo.cc	(revision 279)
@@ -34,9 +34,4 @@
   typedef Graph::Node Node;
   typedef Graph::Edge Edge;
-  //typedef Graph::NodeIt NodeIt;
-  //typedef Graph::EdgeIt EdgeIt;
-  //typedef Graph::OutEdgeIt OutEdgeIt;
-  //typedef Graph::InEdgeIt InEdgeIt;
-  //typedef Graph::SymEdgeIt SymEdgeIt;
  
   Graph G;
@@ -100,13 +95,11 @@
     
     cout << "bfs and dfs iterator demo on the directed graph" << endl;
-    for(GW::NodeIt n=gw.first<GW::NodeIt>(); 
-	gw.valid(n); 
-	gw.next(n)) { 
+    for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { 
       cout << node_name.get(n) << ": ";
       cout << "out edges: ";
-      for(GW::OutEdgeIt e=gw.first<GW::OutEdgeIt>(n); gw.valid(e); gw.next(e)) 
+      for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
 	cout << edge_name.get(e) << " ";
       cout << "in edges: ";
-      for(GW::InEdgeIt e=gw.first<GW::InEdgeIt>(n); gw.valid(e); gw.next(e)) 
+      for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
 	cout << edge_name.get(e) << " ";
       cout << endl;
@@ -178,11 +171,11 @@
     
     cout << "bfs and dfs iterator demo on the reversed directed graph" << endl;
-    for(GW::NodeIt n=gw.first<GW::NodeIt>(); gw.valid(n); gw.next(n)) { 
+    for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { 
       cout << node_name.get(n) << ": ";
       cout << "out edges: ";
-      for(GW::OutEdgeIt e=gw.first<GW::OutEdgeIt>(n); gw.valid(e); gw.next(e)) 
+      for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
 	cout << edge_name.get(e) << " ";
       cout << "in edges: ";
-      for(GW::InEdgeIt e=gw.first<GW::InEdgeIt>(n); gw.valid(e); gw.next(e)) 
+      for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
 	cout << edge_name.get(e) << " ";
       cout << endl;
@@ -254,11 +247,11 @@
     
     cout << "bfs and dfs iterator demo on the undirected graph" << endl;
-    for(GW::NodeIt n=gw.first<GW::NodeIt>(); gw.valid(n); gw.next(n)) { 
+    for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { 
       cout << node_name.get(n) << ": ";
       cout << "out edges: ";
-      for(GW::OutEdgeIt e=gw.first<GW::OutEdgeIt>(n); gw.valid(e); gw.next(e)) 
+      for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
 	cout << edge_name.get(e) << " ";
       cout << "in edges: ";
-      for(GW::InEdgeIt e=gw.first<GW::InEdgeIt>(n); gw.valid(e); gw.next(e)) 
+      for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
 	cout << edge_name.get(e) << " ";
       cout << endl;
Index: src/work/list_graph.h
===================================================================
--- src/work/list_graph.h	(revision 265)
+++ src/work/list_graph.h	(revision 279)
@@ -310,6 +310,6 @@
     bool valid(Edge e) const { return e.valid(); }
     
-    template <typename It> It getNext(It it) const { 
-      It tmp(it); next(tmp); return tmp; }
+//    template <typename It> It getNext(It it) const { 
+//      It tmp(it); next(tmp); return tmp; }
 //     NodeIt& next(NodeIt& it) const { return ++it; }
 //     EdgeIt& next(EdgeIt& it) const { return ++it; }
Index: src/work/marci/graph_wrapper.h
===================================================================
--- src/work/marci/graph_wrapper.h	(revision 275)
+++ src/work/marci/graph_wrapper.h	(revision 279)
@@ -449,5 +449,4 @@
 //   };
 
-
   template<typename GraphWrapper>
   class RevGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
@@ -455,4 +454,12 @@
     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
     typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
+    //FIXME 
+    //If GraphWrapper::OutEdgeIt is not defined
+    //and we do not want to use RevGraphWrapper::InEdgeIt,
+    //this won't work, because of typedef
+    //OR
+    //graphs have to define their non-existing iterators to void
+    //Unfortunately all the typedefs are instantiated in templates, 
+    //unlike other stuff
     typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt InEdgeIt;
     typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt OutEdgeIt;
@@ -703,4 +710,5 @@
     class Edge {
       friend class UndirGraphWrapper<GraphWrapper>;
+    protected:
       bool out_or_in; //true iff out
       GraphOutEdgeIt out;
