 #   hubot tc list projects - Show all available projects
 #   hubot tc list buildTypes - Show all available build types
 #   hubot tc list buildTypes of <project> - Show all available build types for the specified project
-#   hubot tc list builds <buildType> - Show the status of the last 5 builds 
-#   hubot tc list builds of <buildType> of <project> - Show the status of the last 5 builds of the specified build type of the specified project
+#   hubot tc list builds <buildType> <number> - Show the status of the last <number> builds. Number defaults to five.
+#   hubot tc list builds of <buildType> of <project> <number>- Show the status of the last <number> builds of the specified build type of the specified project. <number> Defined to 5
 #   hubot tc build start <buildType> - Adds a build to the queue for the specified build type
 #   hubot tc build start <buildType> of <project> - Adds a build to the queue for the specified build type of the specified project
-#
-# Author:
+#   hubot tc build stop all <buildType> of <project> - Stops all currently running builds of a given buildType. Project parameter is optional.
+#   hubot tc build stop <buildType> <buildId> of <project> - Stops the build type of project with the buildId if currently running. Project parameter is optional.
+#
+# Authors:
 #   Micah Martin and Jens Jahnke
-
-util  = require 'util'
-_     = require 'underscore'
+#Contributors:
+#   Abraham Polishchuk
+
+util           = require 'util'
+_              = require 'underscore'
+asynchron      = require 'async'
 
 module.exports = (robot) ->
   username = process.env.HUBOT_TEAMCITY_USERNAME

        if buildTypeMatches?
          configuration = buildTypeMatches[1]
          project = buildTypeMatches[2]
   
        getBuilds msg, project, configuration, (err, msg, builds) ->
          if not builds
            msg.send "Could not find builds for #{option}"
            return

          for build in builds
            mapBuildTypeIdToName msg, build['buildTypeId'], (err, msg, name)->
              baseMessage = "##{build.number} of #{name} #{build.webUrl}"
              if build.running
                status = if build.status == "SUCCESS" then "**Winning**" else "__FAILING__"
                message = "#{status} #{build.percentageComplete}% Complete :: #{baseMessage}"
              else
                status = if build.status == "SUCCESS" then "OK!" else "__FAILED__"
                message = "#{status} :: #{baseMessage}"

              msg.send message

          matches = option.match(projectRE)
          if matches? and matches.length > 1
            project = matches[1]

        getBuildTypes msg, project, (err, msg, buildTypes) ->
          message = ""
          for buildType in buildTypes
