diff --git a/map-builder.tar b/map-builder.tar
new file mode 100644
index 0000000000000000000000000000000000000000..835d5e868828b3cdfc23e3f2cc3cc0d84466a142
Binary files /dev/null and b/map-builder.tar differ
diff --git a/mapbuilder/src/main/java/map/builder/osm/OSMConnectedComponentParser.java b/mapbuilder/src/main/java/map/builder/osm/OSMConnectedComponentParser.java
index d66ab80b4f87499c1a2847d93bbd13a0a0f42a85..44d1f2223ce2b598b88258a9fa0f4c6a623fee77 100644
--- a/mapbuilder/src/main/java/map/builder/osm/OSMConnectedComponentParser.java
+++ b/mapbuilder/src/main/java/map/builder/osm/OSMConnectedComponentParser.java
@@ -36,7 +36,7 @@ public class OSMConnectedComponentParser {
             Segment segment = segmentsMap.get(key);
             Long startNodeID = segment.getStartNode();
             Long endNodeID = segment.getEndNode();
-            if ((!component.contains(startNodeID)) && (!component.contains(endNodeID))) {
+            if ((!component.contains(startNodeID)) || (!component.contains(endNodeID))) {
                 segmentIDsToRemove.add(key);
             }
         }
diff --git a/mapbuilder/src/main/java/map/builder/utilities/ConnectedComponentGraph.java b/mapbuilder/src/main/java/map/builder/utilities/ConnectedComponentGraph.java
index 9504289a703259db68c28ad8783f63c2ca125eac..35065db4c855e127a24fb2252aa9d3ee87ae529e 100644
--- a/mapbuilder/src/main/java/map/builder/utilities/ConnectedComponentGraph.java
+++ b/mapbuilder/src/main/java/map/builder/utilities/ConnectedComponentGraph.java
@@ -28,39 +28,42 @@ public class ConnectedComponentGraph {
         adj.get(v).add(w);
     }
 
-    // A recursive function to print DFS starting from v
-    public ArrayList<Long> DFSUtil(Long v, HashMap<Long, Boolean> visited) {
-        // Mark the current node as visited and print it
-        visited.put(v, true);
-
-        ArrayList<Long> component = new ArrayList<Long>();
-        Long n;
-
-        // Recur for all the vertices adjacent to this vertex
-        Iterator<Long> i = adj.get(v).iterator();
-        while (i.hasNext()) {
-            n = i.next();
-            if (!visited.get(n))
-                component = DFSUtil(n, visited, component);
-        }
-        component.add(v);
-        return component;
-    }
+    // iterative function for calculating DFS
+    public ArrayList<Long> DFS(Long s, HashMap<Long, Boolean> visited) {
+        // Create a stack for DFS
+        Stack<Long> stack = new Stack<Long>();
+        ArrayList<Long> vertices = new ArrayList<Long>();
+
+        // Push the current source node
+        stack.push(s);
+
+        while (stack.empty() == false) {
+            // Pop a vertex from stack and print it
+            s = stack.peek();
+            stack.pop();
+
+            // Stack may contain same vertex twice. So
+            // we need to print the popped item only
+            // if it is not visited.
+            if (visited.get(s) == false) {
+                visited.put(s, true);
+                vertices.add(s);
+            }
+
+            // Get all adjacent vertices of the popped vertex s
+            // If a adjacent has not been visited, then push it
+            // to the stack.
+            Iterator<Long> itr = adj.get(s).iterator();
+
+            while (itr.hasNext()) {
+                Long v = itr.next();
+                if (!visited.get(v))
+                    stack.push(v);
+            }
 
-    public ArrayList<Long> DFSUtil(Long v, HashMap<Long, Boolean> visited, ArrayList<Long> list) {
-        // Mark the current node as visited and print it
-        visited.put(v, true);
-        Long n;
-
-        // Recur for all the vertices adjacent to this vertex
-        Iterator<Long> i = adj.get(v).iterator();
-        while (i.hasNext()) {
-            n = i.next();
-            if (!visited.get(n))
-                DFSUtil(n, visited, list);
         }
-        list.add(v);
-        return list;
+
+        return vertices;
     }
 
     // Function that returns reverse (or transpose) of this ConnectedComponentGraph
@@ -81,20 +84,32 @@ public class ConnectedComponentGraph {
     }
 
     public void fillOrder(Long v, HashMap<Long, Boolean> visited, Stack<Long> stack) {
-        // Mark the current node as visited and print it
-        visited.put(v, true);
-
-        // Recur for all the vertices adjacent to this vertex
-        Iterator<Long> i = adj.get(v).iterator();
-        while (i.hasNext()) {
-            Long n = i.next();
-            if (!visited.get(n))
-                fillOrder(n, visited, stack);
-        }
+        // Create a stack for filling
+        Stack<Long> helperStack = new Stack<Long>();
+
+        // Push the current source node
+        helperStack.push(v);
+        while (helperStack.empty() == false) {
+            // Pop a vertex from stack and print it
+            v = helperStack.peek();
+            helperStack.pop();
+            // Stack may contain same vertex twice. So
+            // we need to print the popped item only
+            // if it is not visited.
+            if (visited.get(v) == false) {
+                visited.put(v, true);
+            }
+
+            Iterator<Long> itr = adj.get(v).iterator();
 
-        // All vertices reachable from v are processed by now,
-        // push v to Stack
-        stack.push(v);
+            while (itr.hasNext()) {
+                Long s = itr.next();
+                if (!visited.get(s))
+                    helperStack.push(s);
+            }
+
+            stack.push(v);
+        }
     }
 
     // The main function that finds and prints all strongly
@@ -110,6 +125,7 @@ public class ConnectedComponentGraph {
 
         // Fill vertices in stack according to their finishing
         // times
+
         for (Long i : this.adj.keySet())
             if (visited.get(i) == false)
                 fillOrder(i, visited, stack);
@@ -130,7 +146,7 @@ public class ConnectedComponentGraph {
 
             // Print Strongly connected component of the popped vertex
             if (visited.get(v) == false) {
-                ArrayList<Long> component = gr.DFSUtil(v, visited);
+                ArrayList<Long> component = gr.DFS(v, visited);
                 if (maxLength < component.size()) {
                     maxLength = component.size();
                     largestComponent = component;