         msg.finish
         return
 
-      withScheduleMatching msg, msg.match[2], (schedule) ->
-
-        scheduleId = schedule.id
-        return unless scheduleId
+      withScheduleMatching msg, msg.match[2], (matchingSchedule) ->
+
+        return unless matchingSchedule.id
 
         start     = moment().format()
         minutes   = parseInt msg.match[3]

    pagerDutyGet msg, "/schedules", query, (json) ->
      buffer = ''
      schedules = json.schedules
      if schedules
        for schedule in schedules
          buffer += "* #{schedule.name} - https://#{pagerDutySubdomain}.pagerduty.com/schedules##{schedule.id}\n"
        msg.send buffer
      else
        msg.send 'No schedules found!'


  robot.respond /(pager|major)( me)? (schedule|overrides)( (.+))?$$/i, (msg) ->
    query = {

      until: oneHour,
      overflow: 'true'
    }
    pagerDutyGet msg, "/schedules/#{schedule.id}/entries", query, (json) ->
      if json.entries and json.entries.length > 0
        cb(json.entries[0].user.name, schedule)

  pagerDutyIncident = (msg, incident, cb) ->
    pagerDutyGet msg, "/incidents/#{encodeURIComponent incident}", {}, (json) ->
