     getBuildTypes msg, project, (err, msg, buildTypes) ->
       callback msg, execute(buildTypes)
 
-  mapBuildToName = (build, callback) ->
+  mapBuildToNameList = (build) ->
     id = build['buildTypeId']
     msg = build['messengerBot']
     url = "http://#{hostname}/httpAuth/app/rest/buildTypes/id:#{id}"

      .get() (err, res, body) ->
        err = body unless res.statusCode == 200
        builds = JSON.parse(body).build unless err
        callback err, msg, builds

  mapNameToIdForBuildType = (msg, project, name, callback) ->

            msg.send "Could not find builds for #{option}"
            return
          createAndPublishBuildMap(builds, msg)

  robot.respond /tc build stop all (.*)/i, (msg) ->
    getCurrentBuilds msg, (err, builds, msg) ->
      if typeof(builds)=='string'
        builds=JSON.parse(builds)
      if builds['count']==0
        msg.send "No builds are currently running"
        return

      configuration = buildName = msg.match[1]
      project = null
      id = null
      buildTypeRE = /(.*) if (.*) of (.*)/i
      buildTypeMatches = buildName.match buildTypeRE
      if buildTypeMatches?
        configuration = buildTypeMatches[1]
        id = buildTypeMatches[2]
        project = buildTypeMatches[3]

      else
        buildTypeRE = /(.*) of (.*)/i
        buildTypeMatches = buildName.match buildTypeRE
        if buildTypeMatches?
          configuration = buildTypeMatches[1]
          project = buildTypeMatches[2]

        else
          buildTypeRE = /(.*) id (.*)/
          buildTypeMatches = buildName.match buildTypeRE
          if buildTypeMatches?
            configuration = buildTypeMatches[1]
            id = buildTypeMatches[2]
          else
            buildTypeRE= /(.*)/
            buildTypeMatches = buildName.match buildTypeRE
            if buildTypeMatches?
              configuration = buildTypeMatches[1]

      mapAndKillBuilds(msg, configuration, id, project)