     url = "#{base_url}/httpAuth/app/rest#{projectSegment}/buildTypes/name:#{encodeURIComponent(configuration)}/builds"
     msg.http(url)
       .headers(getAuthHeader())
-      .query(locator: ["lookupLimit:5","running:any"].join(","))
+      .query(locator: ["lookupLimit:#{amount}","running:any"].join(","))
       .get() (err, res, body) ->
         err = body unless res.statusCode == 200
         builds = JSON.parse(body).build unless err

          if err
            msg.send "Fail! Something went wrong. Couldn't start the build for some reason"
          else
            msg.send "Dropped a build in the queue for #{buildName}. Run `tc list builds #{buildName}` to check the status"

  robot.respond /tc list (projects|buildTypes|builds) ?(.*)?/i, (msg) ->
    type = msg.match[1]

        configuration = option
        project = null

        buildTypeRE = /^\s*of (.*?) of (.*) (\d*)/i

        buildTypeMatches = option.match buildTypeRE
        if buildTypeMatches?
          configuration = buildTypeMatches[1]
          project = buildTypeMatches[2]
          amount = parseInt(buildTypeMatches[3])
          console.log amount
        else
          buildTypeRE = /^\s*of (.*) (\d*)/i
          buildTypeMatches = option.match buildTypeRE
          if buildTypeMatches?
            configuration = buildTypeMatches[1]
            amount = parseInt(buildTypeMatches[2])
            project = null
          else
            amount = 5
            buildTypeRE = /^\s*of (.*?) of (.*)/i

            buildTypeMatches = option.match buildTypeRE
            if buildTypeMatches?
              configuration = buildTypeMatches[1]
              project = buildTypeMatches[2]
            else
              buildTypeRE = /^\s*of (.*)/i
              buildTypeMatches = option.match buildTypeRE
              if buildTypeMatches?
                configuration = buildTypeMatches[1]
                project = null


        getBuilds msg, project, configuration, amount, (err, msg, builds) ->
          if not builds
            msg.send "Could not find builds for #{option}"
            return
