             
             if(response.result.isSuccess) {
                 if let gamesInfoDict = response.result.value as? [String : AnyObject] {
-                    var games = [TwitchGame]()
-                    for gameDict in gamesInfoDict["games"] as! [[String : AnyObject]] {
-                        if let game = TwitchGame(dict: gameDict) {
-                            games.append(game)
-                        }
-                    }
-                    completionHandler(games: games, error: nil)
-                    return
-                }
-                else {
-                    let userInfo = [
-                        NSLocalizedDescriptionKey : String("Operation was unsuccessful."),
-                        NSLocalizedFailureReasonErrorKey: String("Could not parse data to a valid NSDictionnary object"),
-                        NSLocalizedRecoverySuggestionErrorKey: String("Please ensure that the provided url is valid")
-                    ]
-                    completionHandler(games: nil, error: NSError(domain: "TwitchAPI", code: 3, userInfo: userInfo))
-                    return
-                }
+                    if let gamesDicts = gamesInfoDict["games"] as? [[String : AnyObject]] {
+                        var games = [TwitchGame]()
+                        for gameDict in gamesDicts {
+                            if let game = TwitchGame(dict: gameDict) {
+                                games.append(game)
+                            }
+                        }
+                        completionHandler(games: games, error: nil)
+                        return
+                    }
+                }
+                let userInfo = [
+                    NSLocalizedDescriptionKey : String("Operation was unsuccessful."),
+                    NSLocalizedFailureReasonErrorKey: String("Could not parse data to a valid NSDictionnary object"),
+                    NSLocalizedRecoverySuggestionErrorKey: String("Please ensure that the provided url is valid")
+                ]
+                completionHandler(games: nil, error: NSError(domain: "TwitchAPI", code: 3, userInfo: userInfo))
+                return
             }
             else {
                 let userInfo = [

                "redirect_uri"      :   "https://com.rivusmedia.GamingStreamsTVApp.auth",
                "scope"             :   "" ])
            .responseJSON { response in
            //sup
                print(response)
        }
    }

            [   "limit"     : limit,
                "offset"    : offset,
                "query"     : term    ])
        .responseJSON { response in
            
            if(response.result.isSuccess) {
                if let streamsInfoDict = response.result.value as? [String : AnyObject] {
                    if let streamsDicts = streamsInfoDict["streams"] as? [[String : AnyObject]] {
                        var streams = [TwitchStream]()
                        for streamDict in streamsDicts {
                            if let channelDict = streamDict["channel"] as? [String : AnyObject] {
                                if let channel = TwitchChannel(dict: channelDict), stream = TwitchStream(dict: streamDict, channel: channel) {
                                    streams.append(stream)
                                }
                            }
                        }
                        completionHandler(streams: streams, error: nil)
                        return
                    }
                }
                let userInfo = [
                    NSLocalizedDescriptionKey : String("Operation was unsuccessful."),
                    NSLocalizedFailureReasonErrorKey: String("Could not parse data to a valid NSDictionnary object"),
                    NSLocalizedRecoverySuggestionErrorKey: String("Please ensure that the provided game is valid")
                ]
                completionHandler(streams: nil, error: NSError(domain: "TwitchAPI", code: 3, userInfo: userInfo))
                return
            }
            else {
                let userInfo = [
                    NSLocalizedDescriptionKey : String("Operation was unsuccessful."),
                    NSLocalizedFailureReasonErrorKey: String("The operation returned an error : %@", response.result.error.debugDescription),
                    NSLocalizedRecoverySuggestionErrorKey: String("Please ensure that the provided channel is valid")
                ]
                completionHandler(streams: nil, error: NSError(domain: "TwitchAPI", code: 1, userInfo: userInfo))
                return
            }
        }
    }
    
