                             s = []
                         for i in results.Entrances
                             if i.StationCode1 not in s
-                                msg.http("http://api.wmata.com/Rail.svc/json/jStationInfo?StationCode=#{i.StationCode1}&api_key=xqv42tjfvz4abb9y9averdvd")
+                                msg.http("http://api.wmata.com/Rail.svc/json/jStationInfo?StationCode=#{i.StationCode1}&api_key=#{key}")
                                 .get() (err, resp, body) ->
                                     results = JSON.parse body
                                     arr += "#{results.Name}\n"
                                 s.push i.StationCode1
-                        msg.http("http://api.wmata.com/Bus.svc/json/jStops?lat=#{resp[0].latitude}&lon=#{resp[0].longitude}&radius=200&api_key=xqv42tjfvz4abb9y9averdvd")
+                        msg.http("http://api.wmata.com/Bus.svc/json/jStops?lat=#{resp[0].latitude}&lon=#{resp[0].longitude}&radius=200&api_key=#{key}")
                         .get() (err, res, body) ->
                             results = JSON.parse body
                             if results.Stops.length > 0

            else if search.match station_regex
                station = search.match station_regex
                arr = ""
                msg.http("http://api.wmata.com/Rail.svc/json/jStationInfo?StationCode=#{stations[station[0]][0]}&api_key=xqv42tjfvz4abb9y9averdvd")
                .get() (err, resp, body) ->
                    results = JSON.parse body
                    arr += "Here are the predictions for #{results.Name}:\n\n"
                    for s in stations[station[0]]
                        msg.http("http://api.wmata.com/StationPrediction.svc/json/GetPrediction/#{s}?api_key=xqv42tjfvz4abb9y9averdvd")
                        .get() (err, resp, body) ->
                            results = JSON.parse body
                            for i in results.Trains

module.exports = (robot) ->

    robot.respond /(metro|wmata)(\s+(.+))?/i, (msg) ->
        key = process.env.HUBOT_WMATA_API_KEY
        if msg.match[3]
            search = msg.match[3]
            # Bus incident search by route name
            if search.match /^(\d\d|\w\d)$/i
                msg.http("http://api.wmata.com/Incidents.svc/json/BusIncidents?Route=#{search}&api_key=#{key}")
                .get() (err, resp, body) ->
                    arr = []
                    results = JSON.parse body
