     
     // MARK: - Stored locations management
     
+    var selectedLocationIndex: Int? {
+        get {
+            let userDefaults = NSUserDefaults.standardUserDefaults()
+            let number = userDefaults.objectForKey("selectedLocationIndex") as! NSNumber?
+            return number?.integerValue
+        }
+        set(index) {
+            let number: NSNumber? = index != nil ? NSNumber(long: index!) : nil
+            let userDefaults = NSUserDefaults.standardUserDefaults()
+            userDefaults.setObject(number, forKey: "selectedLocationIndex")
+        }
+    }
+    
     func addLocationWithName(name: String, country: String, countryCode: String) {
         self.locationCoreDataModel?.newItemWithName(name, country: country, countryCode: countryCode)
     }

    // MARK: - Forecast
    
    func forecastForSelectedLocation(callback: ([WeatherDataItem]?, NSError?) -> Void) {
        if let index = self.selectedLocationIndex {
            let item = self.locations[index]
            self.forecastForLocationItem(item, callback: callback)
        } else {
            self.forecastForCurrentLocation(callback)
        }

        super.init()
    }
    
    // MARK: - Weather
    
    func weatherForSelectedLocation(callback: (WeatherDataItem?, NSError?) -> Void) {
        if let location = self.selectedLocation {
            self.weatherForLocationItem(location, callback: callback)
        } else {
            self.weatherForCurrentLocation(callback)
        }
