             msg.send "Viewers: #{object.stream.viewers}"
 
     robot.respond /ttv top/i, (msg) ->
-        createURL = (game) ->
-            "http://www.twitch.tv/directory/game/#{encodeURIComponent(game)}"
+        createGameURL = (game) ->
+            "https://www.twitch.tv/directory/game/#{encodeURIComponent(game)}"
 
-        twitchRequest msg, "/games/top", limit: maxResults, (object) ->
+        GetTwitchResult msg, "/games/top", null, (object) ->
             for gameObj, i in object.top
-                msg.send "#{i + 1}. #{gameObj.game.name} | Viewers: #{gameObj.viewers} | Channels: #{gameObj.channels} | #{createURL(gameObj.game.name)}"
+                msg.send "#{i + 1}. #{gameObj.game.name} | Viewers: #{gameObj.viewers} | Channels: #{gameObj.channels} | #{createGameURL(gameObj.game.name)}"
 
-twitchRequest = (msg, api, params = {}, handler) ->
+GetTwitchResult = (msg, api, params = {}, handler) ->
+    params.limit or= TWITCH_MAX_RESULTS
     msg.http("https://api.twitch.tv/kraken#{api}")
         .query(params)
         .get() (err, res, body) ->

                channel = stream.channel
                msg.send "#{channel.display_name} (\"#{channel.status}\"): #{channel.url} [Viewers: #{stream.viewers}]"

            if object._total > maxResults
                msg.reply "There are #{object._total - maxResults} other \"#{category}\" live streams."

    robot.respond /ttv search (.+)/i, (msg) ->
        query = msg.match[1]
        twitchRequest msg, "/search/streams", { q: query, limit: maxResults }, (object) ->
            if object._total is 0
                msg.reply "No live streams were found using search query: \"#{query}\". Try a different query or try again later."
                return

        return

    robot.respond /ttv featured/i, (msg) ->
        GetTwitchResult msg, '/streams/featured', null, (object) ->
            for feature in object.featured
                channel = feature.stream.channel
                msg.send "#{feature.stream.game}: #{channel.display_name} (#{channel.status}) - #{channel.url} [Viewers: #{feature.stream.viewers}]"

    robot.respond /ttv game (.+)/i, (msg) ->
        category = msg.match[1]
        GetTwitchResult msg, '/streams', { game: category }, (object) ->
            if object._total is 0
                msg.reply "No live streams were found in \"#{category}\". Try a different category or try again later."
                return
