 
 	let locationManager = CLLocationManager()
 
-	var parkinglots: [Parkinglot] = []
-	var defaultSortedParkinglots: [Parkinglot] = []
+	var parkinglots = [Lot]()
+	var defaultSortedParkinglots = [Lot]()
 
 	var timeUpdated: Date?
 	var timeDownloaded: Date?


import UIKit
import CoreLocation
import SwiftyTimer
import Crashlytics


		// Set title to selected city
		updateTitle(withCity: nil)

        guard let selectedCity = UserDefaults.standard.string(forKey: Defaults.selectedCity),
            let sortingType = UserDefaults.standard.string(forKey: Defaults.sortingType) else {
            return
        }
        Answers.logCustomEvent(withName: "View City", customAttributes: ["selected city": selectedCity, "sorting type": sortingType])

        ParkKit().fetchCities(onFailure: { [weak self] error in
            self?.handleUpdateError(error)
            self?.stopRefreshUI()
        }) { [weak self] response in
            self?.stopRefreshUI()

            let showExperimentalCities = UserDefaults.standard.bool(forKey: Defaults.showExperimentalCities) 
            let citiesList = showExperimentalCities ? response.cities : response.cities.filter { $0.hasActiveSupport }
            (UIApplication.shared.delegate as? AppDelegate)?.citiesList = citiesList

            ParkKit().fetchLots(forCity: selectedCity, onFailure: { [weak self] error in
                self?.handleUpdateError(error)
                self?.stopRefreshUI()
            }) { [weak self] response in
                self?.stopRefreshUI()

                let skipNodataLots = UserDefaults.standard.bool(forKey: Defaults.skipNodataLots)
                let lots = skipNodataLots ? response.lots.filter { $0.state != .nodata } : response.lots

                self?.parkinglots = lots
                self?.defaultSortedParkinglots = lots

                self?.timeUpdated = response.lastUpdated
                self?.timeDownloaded = response.lastDownloaded

                self?.showOutdatedDataWarning(lastUpdated: response.lastUpdated, lastDownloaded: response.lastDownloaded)
            }
        }
	}

    func showOutdatedDataWarning(lastUpdated: Date, lastDownloaded: Date) {
        // TODO: Use both dates to give a diff to the user or show that the server seems to be broken.
        let now = Date()
        let calendar = Calendar(identifier: .gregorian)
        let dateDiff = calendar.dateComponents(Set([.minute]), from: lastUpdated, to: now)

        var attrs = [String: Any]()

        if let diff = dateDiff.minute, diff >= 60 {
            attrs = [NSForegroundColorAttributeName: UIColor.red]
            drop(L10n.outdatedDataWarning.string, state: .blur(.dark))
        }

        let dateFormatter = DateFormatter(dateFormat: "dd.MM.yyyy HH:mm", timezone: nil)
        self.refreshControl?.attributedTitle = NSAttributedString(string: "\(L10n.lastUpdated(dateFormatter.string(from: lastUpdated)))", attributes: attrs)
    }

	/**
	Called by the request to the API in case of failure and handed the error to display to the user.
	*/
	func handleUpdateError(_ err: ParkError) {
		switch err {
		case .server, .incompatibleAPI:
			drop(L10n.servererror.string, state: .error)
