                     // Code 2: Invalid Parameter Contains an invalid parameter. Arguements passed in aren't valid. (Ex. Amount = Five)
                     case 3: // Token Not Found: Session Token does not exist.
                         self.getSessionToken(completion: {token in
-                            self.sessionToken = token
-                            self.makeRequestForStories(params, completion: {json in
+                            var copyParams = params
+                            copyParams["token"] = token
+                            self.makeRequestForStories(copyParams, completion: {json in
                                 completion(json)
                             })
                         })
                     case 4: // Token Empty: Session Token has returned all possible questions for the specified query. Resetting the Token is necessary.
-                        self.resetSessionToken(token: self.sessionToken, completion: {token in
-                            self.sessionToken = token
-                            self.makeRequestForStories(params, completion: {json in
+                        let oldToken = params["token"] as! String
+                        self.resetSessionToken(token: oldToken, completion: {newToken in
+                            var copyParams = params
+                            copyParams["token"] = newToken
+                            self.makeRequestForStories(copyParams, completion: {json in
                                 completion(json)
                             })
                         })

            "amount" : String(amount),
            "category" : categoryIdString,
            "type" : "boolean",
            "token" : sessionToken
        ]
        
//        if let token = userDefaults.string(forKey: sessionTokenUserDefaultsKey) {
//            
//        }
//        guard let token = userDefaults.string(forKey: sessionTokenUserDefaultsKey) else {
//            
//        }
        
        let token = userDefaults.string(forKey: sessionTokenUserDefaultsKey)
        if token != nil { // Token exists in memory
            if let t = token {
                sessionToken = t
                parameters["token"] = t
                print(parameters["token"] as! String)
                self.makeRequestForStories(parameters, completion: {json in
                    var array = [Story]()
                    for (_, subJson) in json["results"] {

class OpenTriviaDBNetwork {
    private let userDefaults = UserDefaults.standard
    private let baseURL = "https://opentdb.com/"
    
    public func getCategories(completion: @escaping (_ array: [Category]) -> Void) {
        Alamofire.request("\(baseURL)api_category.php").responseJSON(completionHandler: {response in
