 
 import UIKit
 
-class DataManager {
+struct DataManager {
     
     //*****************************************************************
-    // Helper class to get either local or remote JSON
+    // Helper struct to get either local or remote JSON
     //*****************************************************************
     
-    class func getStationDataWithSuccess(success: @escaping ((_ metaData: Data?) -> Void)) {
+    static func getStationDataWithSuccess(success: @escaping ((_ metaData: Data?) -> Void)) {
 
         DispatchQueue.global(qos: .userInitiated).async {
             if useLocalStations {

    // REUSABLE DATA/API CALL METHOD
    //*****************************************************************
    
    class func loadDataFromURL(url: URL, completion:@escaping (_ data: Data?, _ error: Error?) -> Void) {
        
        let sessionConfig = URLSessionConfiguration.default
        sessionConfig.allowsCellularAccess          = true
        sessionConfig.timeoutIntervalForRequest     = 15
        sessionConfig.timeoutIntervalForResource    = 30
        sessionConfig.httpMaximumConnectionsPerHost = 1
        
        let session = URLSession(configuration: sessionConfig)
        
        // Use NSURLSession to get data from an NSURL
        let loadDataTask = session.dataTask(with: url){ data, response, error in
            if let responseError = error {
                completion(nil, responseError)
                
                if kDebugLog { print("API ERROR: \(error!)") }
                
                // Stop activity Indicator
                UIApplication.shared.isNetworkActivityIndicatorVisible = false
                
            } else if let httpResponse = response as? HTTPURLResponse {
                if httpResponse.statusCode != 200 {
                    let statusError = NSError(domain:"com.matthewfecher", code:httpResponse.statusCode, userInfo:[NSLocalizedDescriptionKey : "HTTP status code has unexpected value."])
                    
                    if kDebugLog { print("API: HTTP status code has unexpected value") }
                    
                    completion(nil, statusError)
                    
                } else {
                    
                    // Success, return data
                    completion(data, nil)
                }
            }
        }
        
        loadDataTask.resume()

                    success(data)
                }
            } else {
                guard let stationDataURL = URL(string: stationDataURL) else {
                    if kDebugLog { print("stationDataURL not a valid URL") }
                    success(nil)
                    return
                }
                
                loadDataFromURL(url: stationDataURL) { data, error in
                    success(data)
                }
            }
        }
