Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 6789)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 6874)
@@ -95,4 +95,5 @@
     target += " --top=" + topLeft.lat();
     target += " --bottom=" + botRight.lat();
+    target += " --waylength=" + Main.pref.get(LakewalkerPreferences.PREF_MAX_SEG, "500");
     target += " --maxnodes=" + Main.pref.get(LakewalkerPreferences.PREF_MAX_NODES, "50000");
     target += " --threshold=" + Main.pref.get(LakewalkerPreferences.PREF_THRESHOLD, "35");
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java	(revision 6789)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java	(revision 6874)
@@ -74,5 +74,5 @@
     
     pythonConfig.setValue(Main.pref.get(PREF_PYTHON, "python.exe"));
-    maxSegsConfig.setValue(Main.pref.get(PREF_MAX_SEG, "250"));
+    maxSegsConfig.setValue(Main.pref.get(PREF_MAX_SEG, "500"));
     maxNodesConfig.setValue(Main.pref.get(PREF_MAX_NODES, "50000"));
     thresholdConfig.setValue(Main.pref.get(PREF_THRESHOLD, "35"));
Index: applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java
===================================================================
--- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java	(revision 6789)
+++ applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java	(revision 6874)
@@ -59,5 +59,7 @@
     try {
     	
-      Node fn = null; //new Node(new LatLon(0,0));
+	  Node n = null;  // The current node being created
+	  Node tn = null; // The last node of the previous way
+      Node fn = null; // Node to hold the first node in the trace
     	
       while ((line = input.readLine()) != null) {
@@ -70,16 +72,27 @@
         case 'n':
           String[] tokens = line.split(" ");
-          try {
-            LatLon ll = new LatLon(Double.parseDouble(tokens[1])+northOffset, Double.parseDouble(tokens[2])+eastOffset);
-            Node n = new Node(ll);
-            commands.add(new AddCommand(n));
-            way.nodes.add(n);
-            if(fn==null){
-            	fn = n;
-            }
+          
+          if(tn==null){
+		      try {        	
+		        LatLon ll = new LatLon(Double.parseDouble(tokens[1])+northOffset, Double.parseDouble(tokens[2])+eastOffset);
+		        n = new Node(ll);
+		        if(fn==null){
+		          fn = n;
+		        }
+		        commands.add(new AddCommand(n));
+		      }
+	          catch (Exception ex) {
+	        	  
+		      }
+          
+          } else {
+            // If there is a last node, and this node has the same coordinates
+            // then we substitute for the previous node
+      		n = tn;
+        	tn = null;       	
           }
-          catch (Exception ex) {
-
-          }
+	      
+	      way.nodes.add(n);
+          
           break;
 
@@ -99,4 +112,9 @@
           
           break;
+        
+        case 't':      	
+        	way = new Way();
+        	tn = n;
+        	break;
           
         case 'e':
@@ -107,4 +125,6 @@
       } 
       input.close();
+
+      // Add the start node to the end of the trace to form a closed shape 
       way.nodes.add(fn);
     }
