 	- parameter completion: handler that is provided with a list of supported cities or an error wrapped in an SCResult
 	*/
 	static func sendMetadataRequest(_ completion: @escaping (Metadata?, SCError?) -> Void) {
-		let metadataURL = SCOptions.useStagingAPI ? URL.apiBaseURLStaging : URL.apiBaseURL
+		let metadataURL = SCOptions.useLocalhost ? URL.apiBaseURLLocalhost : URL.apiBaseURL
 		UIApplication.shared.isNetworkActivityIndicatorVisible = true
-		Alamofire.request(.GET, metadataURL).responseJSON { (_, response, result) -> Void in
-			UIApplication.sharedApplication().networkActivityIndicatorVisible = false
-			guard let response = response else { completion(nil, .Request); return }
-			guard response.statusCode == 200 else { completion(nil, .Server); return }
-			guard let data = result.value else { completion(nil, .Server); return }
+		Alamofire.request(metadataURL).responseJSON { response in
+			UIApplication.shared.isNetworkActivityIndicatorVisible = false
+//			guard let response = response.response else { completion(nil, .request); return }
+			guard response.response?.statusCode == 200 else { completion(nil, .server); return }
+			guard let data = response.result.value as? String else { completion(nil, .server); return }
 			
-			let metadata = Mapper<Metadata>().map(data)
+            let metadata = Mapper<Metadata>().map(JSONString: data)
 			
 			// TODO: I have a feeling that this will die mapping the data before being able to check the version if something substantial changes...
 			guard metadata?.apiVersion == SCOptions.supportedAPIVersion else {
 				NSLog("Error: Found API Version \(metadata!.apiVersion). This version of ParkenDD can however only understand \(SCOptions.supportedAPIVersion)")
-				completion(nil, .IncompatibleAPI)
+				completion(nil, .incompatibleAPI)
 				return
 			}
 			

	- parameter completion: handler that is provided with a list of parkinglots or an error wrapped in an SCResult
	*/
	static func sendParkinglotDataRequest(_ city: String, completion: @escaping (ParkinglotData?, SCError?) -> Void) {
		let parkinglotURL = SCOptions.useStagingAPI ? URL.apiBaseURLStaging + city : URL.apiBaseURL + city
		UIApplication.shared.isNetworkActivityIndicatorVisible = true
		Alamofire.request(.GET, parkinglotURL).responseJSON { (_, response, result) -> Void in
			UIApplication.sharedApplication().networkActivityIndicatorVisible = false
			guard let response = response else { completion(nil, .Request); return }
			if response.statusCode == 404 { completion(nil, .NotFound); return }
			guard response.statusCode == 200 else { completion(nil, .Server); return }
			guard let data = result.value else { completion(nil, .Server); return }
			
			let parkinglotData = Mapper<ParkinglotData>().map(data)
			completion(parkinglotData, nil)
		}
	}

	struct SCOptions {
		static let supportedAPIVersion = "1.0"
		static let supportedForecastAPIVersion = "1.0"
		static let useLocalhost = false
	}

	struct URL {
		static let apiBaseURL = "http://api.parkendd.de/"
		static let apiBaseURLLocalhost = "http://localhost:5000"
		static let nominatimURL = "https://nominatim.openstreetmap.org/"
	}

