   
   msg.http(url)
     .auth(user, password)
-    .header('X-Transmission-Session-Id', session_id)
+    .header('X-Transmission-Session-Id', sessionId)
     .post(JSON.stringify({method: "torrent-get", arguments: { fields: ["id", "name", "downloadDir", "percentDone", "files", "isFinished"]}})) (err, res, body) ->
       if res.statusCode == 409
-        get_torrents(msg, res.headers['x-transmission-session-id'], rec_count + 1)
+        getTorrents(msg, res.headers['x-transmission-session-id'], recursions + 1)
       else
         response = ''
         torrents = JSON.parse(body).arguments.torrents


module.exports = (robot) ->
  robot.respond /torrents/i, (msg) ->
    get_torrents(msg)
    
  robot.respond /where('s| is) transmission\??/i, (msg) ->
    msg.send "Transmission is at " + url

user = process.env.HUBOT_TRANSMISSION_USER
password = process.env.HUBOT_TRANSMISSION_PASSWORD || ''

getTorrents = (msg, sessionId = '', recursions = 0) ->
  return if recursions > 4
  
  unless url?
    msg.reply "I don't know where Transmission is. Please configure a URL."
