     d.reject 2
   d.promise
 
-processFn = (helper, files, fn) ->
+processFn = (files, fn) ->
   throw new Error 'Please provide a function to process the files' unless _.isFunction fn
   d = Q.defer()
   _process = (tick) ->

      sftpHelper.download(tmpPath)
      .then (files) ->
        logger.info files, "Processing #{files.length} files..."
        processFn sftpHelper, files, (file) -> importFn(stockimport, "#{tmpPath}/#{file}")
      .then ->
        logger.info 'Processing files complete'
        process.exit(0)

    else
      file = files[tick]
      fn(file)
      .then -> _process(tick + 1)
      .fail (error) -> d.reject error
      .done()
  _process(0)
