                     }
                 }
             }
-            
         }
         
         let messages = predictions["message"]

}

class SwiftBusConnectionHandler: NSObject, NSURLConnectionDataDelegate {
    var currentRequestType:RequestType = .NoRequest
    var connection:NSURLConnection?
    var xmlData = NSMutableData()
    var xmlString:String = ""
    var allAgenciesClosure:([String : TransitAgency] -> Void)?
    var allRoutesForAgencyClosure:([String : TransitRoute] -> Void)?
    var routeConfigClosure:(TransitRoute? -> Void)?
    var stopPredictionsClosure:(([String : [TransitPrediction]], [String]) -> Void)?
    var vehicleLocationsClosure:([String : [TransitVehicle]] -> Void)?
    
    //MARK: Requesting data
    
    func requestAllAgencies(closure: ((agencies:[String : TransitAgency]) -> Void)?) {
        currentRequestType = .AllAgencies
        
        allAgenciesClosure = closure

    }
    
    //Request data for all lines
    func requestAllRouteData(agencyTag: String, closure: (agencyRoutes:[String : TransitRoute]) -> Void) {
        currentRequestType = .AllRoutes
        
        allRoutesForAgencyClosure = closure
