   cb(newUrl)
 
 treeversal = (msg, cb, node="") ->
-  data = {}
+  data = []
   if node == ""
     prefix = "*"
   else

        if nodes[i].leaf == 0
          treeversal(msg, cb, nodes[i].id)
        else
          cb(nodes[i]) unless nodes[i].id == "no-click"
        i++

construct_port = () ->
  port = ':'


module.exports = (robot) ->
  robot.hear /graphite search (\w+)/i, (msg) ->
    treeversal msg, (data) ->
      output = ""
      output += metric.id + "\n" for metric in data
      msg.send output
  robot.hear /graphite show (\S+)/i, (msg) ->
    treeversal msg, (data) ->
      construct_url msg, data[0].graphUrl, (url) ->
        msg.send url

construct_url = (msg, graphUrl, cb) ->
  cb(graphUrl) unless process.env.GRAPHITE_AUTH
