                             route.agencyTag = agencyTag
                         }
                         
+                        guard let currentAgency = innerAgencies[agencyTag] else {
+                            completion?(.error(SwiftBusError.error(with: .unknownAgency)))
+                            return
+                        }
+                        
                         //Saving the routes for the agency
                         currentAgency.agencyRoutes = agencyRoutes
                         

            switch result {
            case let .success(innerAgencies) where innerAgencies[agencyTag] != nil:
                
                let currentAgency = innerAgencies[agencyTag]!
                
                //The agency exists & we need to load the transit agency data
                let connectionHandler = SwiftBusConnectionHandler()

    }
    
    /**
     Gets the TransitRoutes for a particular agency. If the list of agencies hasn't been downloaded, this functions gets them first
     
     - parameter agency:       Agency object
     - parameter completion:   Code that is called after everything has loaded
     - parameter agency:   Optional TransitAgency object that contains the routes
     */
    open func configuration(forAgencyTag agencyTag: String?, completion: ((_ agency: SwiftBusResult<TransitAgency>) -> Void)?) {
        
        guard let agencyTag = agencyTag else {
