     
     func updateCurrentCurrencies() {
         
+        func showActivityIndicator() {
+            UIApplication.sharedApplication().networkActivityIndicatorVisible = true
+            NSNotificationCenter.defaultCenter().postNotificationName("UpdateActivityIndicator", object: nil, userInfo: ["currencyCode": self.inputCurrency.code, "action": "show"])
+            NSNotificationCenter.defaultCenter().postNotificationName("UpdateActivityIndicator", object: nil, userInfo: ["currencyCode": self.outputCurrency.code, "action": "show"])
+        }
+        
+        func hideActivityIndicator() {
+            // Update UI on main thread.
+            dispatch_async(dispatch_get_main_queue()) {
+                UIApplication.sharedApplication().networkActivityIndicatorVisible = false
+                NSNotificationCenter.defaultCenter().postNotificationName("UpdateActivityIndicator", object: nil, userInfo: ["currencyCode": self.inputCurrency.code, "action": "hide"])
+                NSNotificationCenter.defaultCenter().postNotificationName("UpdateActivityIndicator", object: nil, userInfo: ["currencyCode": self.outputCurrency.code, "action": "hide"])
+            }
+        }
+        
         // Start by showing the network indicator.
-        UIApplication.sharedApplication().networkActivityIndicatorVisible = true
+        showActivityIndicator()
         
         let url = NSURL(string: "https://query.yahooapis.com/v1/public/yql?q=" +
             "select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(" +

                fetchedOutputRate = try xml["query"]["results"]["rate"].withAttr("id", "USD" + self.outputCurrency.code)["Rate"].element!.text!
            } catch {
                print("Error fetching currencies: \(error)")
                return
            }
            
            // Update rates on converter.
            self.inputCurrency.rate = Double(fetchedInputRate)
            self.outputCurrency.rate = Double(fetchedOutputRate)
            print("Updated input and output currency rates.")
            
            // CoreData setup.
            let managedObjectContext: NSManagedObjectContext!

                print("Error saving currencies: \(error)")
                return
            }

        }
        
