             
             // CoreData fetching.
             let inputFetch = NSFetchRequest(entityName: "Currency")
-            let inputPredicate = NSPredicate(format: "%K == %@", "code", self.inputCurrency.code)
+            let inputPredicate = NSPredicate(format: "%K == %@", "code", currentInputCurrency)
             inputFetch.predicate = inputPredicate
             inputFetch.fetchLimit = 2
             let outputFetch = NSFetchRequest(entityName: "Currency")
-            let outputPredicate = NSPredicate(format: "%K == %@", "code", self.outputCurrency.code)
+            let outputPredicate = NSPredicate(format: "%K == %@", "code", currentOutputCurrency)
             outputFetch.predicate = outputPredicate
             outputFetch.fetchLimit = 1
             

            
            // Update UI on main thread.
            dispatch_async(dispatch_get_main_queue()) {
                NSNotificationCenter.defaultCenter().postNotificationName("CoinUpdatedNotification", object: nil, userInfo: ["currencyCode": self.inputCurrency.code, "currencyRate": fetchedInputRate])
                NSNotificationCenter.defaultCenter().postNotificationName("CoinUpdatedNotification", object: nil, userInfo: ["currencyCode": self.outputCurrency.code, "currencyRate": fetchedOutputRate])
                print("Updated input and output currency rates.")
            }
            

    
    func updateCurrentCurrencies() {
        
        let currentInputCurrency = inputCurrency.code
        let currentOutputCurrency = outputCurrency.code
        
        func showActivityIndicator() {
            UIApplication.sharedApplication().networkActivityIndicatorVisible = true
            NSNotificationCenter.defaultCenter().postNotificationName("UpdateActivityIndicator", object: nil, userInfo: ["currencyCode": currentInputCurrency, "action": "show"])
            NSNotificationCenter.defaultCenter().postNotificationName("UpdateActivityIndicator", object: nil, userInfo: ["currencyCode": currentOutputCurrency, "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": currentInputCurrency, "action": "hide"])
                NSNotificationCenter.defaultCenter().postNotificationName("UpdateActivityIndicator", object: nil, userInfo: ["currencyCode": currentOutputCurrency, "action": "hide"])
            }
        }
        
