       deferred.reject()
     .on 'end', (r) ->
       offline = false
-      for e of r
+      for e in r
         if e.pkgMeta.version is version
           offline = true
           break
-      deferred.resolve [name, version, cacheName, offline]
+      deferred.resolve {name: name, version: version, cacheName: cacheName, offline: offline}
     deferred.promise
 
-  install = (data) ->
-    isSerialInstall = data isnt undefined
+  install = (item) ->
+    isSerialInstall = item isnt undefined
     deferred = Q.defer()
 
     if isSerialInstall
-      name = data.shift()
-      version = data.shift()
-      cacheName = data.shift()
-      offline = data.shift()
+      name = item.name
+      version = item.version
+      cacheName = item.cacheName
+      offline = item.offline
       installedVersion = getInstalledVersion name
       if installedVersion isnt ''
         # already installed

  log = new Logger logLevel, 'Bower'

  bowerInstallDependency = (item, cb) ->
    cacheName = item.name
    cacheName = item.cacheName if item.hasOwnProperty 'cacheName'
    Q.fcall checkCache, [item.name, item.version, cacheName]
    .then install
    .catch (error) ->
      log.e "Install failed: #{cacheName}: #{if error.stack then error.stack else error}" if error
      common.setExitCode 1
    .done ->
      if !common.hasError() and !fs.existsSync "bower_components/#{cacheName}"
        log.e "Install failed: module does not exist: #{cacheName}"
        common.setExitCode 1
      cb?()


    .done -> cb?()

  validateInstalledDependencies = ->
    for item in dependencies
      unless fs.existsSync "bower_components/#{item.name}"
        common.setExitCode 1
        log.w "Not installed: #{item.name}"
    log.e "Some dependencies are not installed." if common.hasError()

  if parallelize
