             }
         }
         
-        if let closure = allRoutesForAgencyClosure as ([String : TransitRoute] -> Void)! {
-            closure(transitRoutes)
-        }
+        allRoutesForAgencyClosure(transitRoutes)
     }
     
     //Parsing the line definition
     private func parseRouteConfiguration(xml:XMLIndexer) {
-        let currentRoute:TransitRoute = TransitRoute()
+        let currentRoute = TransitRoute()
         var stopDirectionDict: [String : [String]] = [:]
         var allStopsDictionary: [String : TransitStop] = [:]
         
         var routeConfig:[String : String] = xml["body"]["route"].element!.attributes
         
         //Creating the route from the current information
-        if let routeTag = routeConfig["tag"], routeTitle = routeConfig["title"], latMin = routeConfig["latMin"], latMax = routeConfig["latMax"], lonMin = routeConfig["lonMin"], lonMax = routeConfig["lonMax"], routeColorHex = routeConfig["color"], oppositeColorHex = routeConfig["oppositeColor"] {
-            currentRoute.routeTag = routeTag
-            currentRoute.routeTitle = routeTitle
-            currentRoute.latMin = (latMin as NSString).doubleValue
-            currentRoute.latMax = (latMax as NSString).doubleValue
-            currentRoute.lonMin = (lonMin as NSString).doubleValue
-            currentRoute.lonMax = (lonMax as NSString).doubleValue
-            currentRoute.routeColor = routeColorHex
-            currentRoute.oppositeColor = oppositeColorHex
-            #if os(OSX)
-            currentRoute.representedRouteColor = NSColor(rgba: "#" + routeColorHex)
-            currentRoute.representedOppositeColor = NSColor(rgba: "#" + oppositeColorHex)
-            #else
-            currentRoute.representedRouteColor = UIColor(rgba: "#" + routeColorHex)
-            currentRoute.representedOppositeColor = UIColor(rgba: "#" + oppositeColorHex)
-            #endif
-        }
+        guard let routeTag = routeConfig["tag"], routeTitle = routeConfig["title"], latMin = routeConfig["latMin"], latMax = routeConfig["latMax"], lonMin = routeConfig["lonMin"], lonMax = routeConfig["lonMax"], routeColorHex = routeConfig["color"], oppositeColorHex = routeConfig["oppositeColor"] else {
+            //Couldn't get the route information, return
+            routeConfigClosure(currentRoute)
+            return
+        }
+        
+        currentRoute.routeTag = routeTag
+        currentRoute.routeTitle = routeTitle
+        currentRoute.latMin = (latMin as NSString).doubleValue
+        currentRoute.latMax = (latMax as NSString).doubleValue
+        currentRoute.lonMin = (lonMin as NSString).doubleValue
+        currentRoute.lonMax = (lonMax as NSString).doubleValue
+        currentRoute.routeColor = routeColorHex
+        currentRoute.oppositeColor = oppositeColorHex
+        #if os(OSX)
+        currentRoute.representedRouteColor = NSColor(rgba: "#" + routeColorHex)
+        currentRoute.representedOppositeColor = NSColor(rgba: "#" + oppositeColorHex)
+        #else
+        currentRoute.representedRouteColor = UIColor(rgba: "#" + routeColorHex)
+        currentRoute.representedOppositeColor = UIColor(rgba: "#" + oppositeColorHex)
+        #endif
         
         let stopDirections:XMLIndexer = xml["body"]["route"]["direction"]
         

            }
        }
        
        if let closure = vehicleLocationsClosure as ([String : [TransitVehicle]] -> Void)! {
            closure(dictionaryOfVehicles)
        }
    }
    
    //Parsing the information for stop predictions

        startConnection(allRoutesURL + agencyTag)
    }
    
    func requestRouteConfiguration(routeTag:String, fromAgency agencyTag:String, closure:(route: TransitRoute?) -> Void) {
        currentRequestType = .RouteConfiguration
        
        routeConfigClosure = closure
