             
             guard let rate = xml["query"]["results"]["rate"]["Rate"].element?.text else {
                 print("Could not parse XML request.")
+                UIApplication.sharedApplication().networkActivityIndicatorVisible = false
                 return
             }
             
             // Update currency record on database.
             self.updateRateRecord(Double(rate)!)
+            UIApplication.sharedApplication().networkActivityIndicatorVisible = false
             
         }
         
         task.resume()
+        
     }
     
     private func updateRateRecord(rate: Double) {

            
            guard data != nil else {
                print("Error performing Yahoo query.")
                return
            }
            

            useLocalization: Bool,
            useSymbol: Bool,
            useCustomSymbol: Bool) {
        
        // CoreData setup.
        let managedObjectContext: NSManagedObjectContext!
