         photoUrl = post['photo-url-1280']
         timestamp = post['unix-timestamp']
 
-        # We know for sure that the URL is a unique key to retrieve data.
+        # We know for sure that the URL is a unique 'key' to retrieve data.
         # File names are built by joining each part of the URL. This can make longer filenames though.
         outputFile = URL.parse(photoUrl).pathname.split('/').join ''
 

      contentLength = parseInt response.headers['content-length']
      if !options.force and (size is contentLength)
        log.notice '! Skipping', output, 'file has the same size (', size, 'bytes).\n'
        return Q.resolve 0

      statusCode = null
      log.debug 'Remote file size:', contentLength, 'local file:', size, '\n'
      req = request.get url
        .on 'error', (error) ->
          Q.reject new ApiError 'While downloading file', error
        .on 'response', (response) ->
          {statusCode} = response

          # A bit hacky but basically, everything not 2XX has to be retried.
          if statusCode / 100 isnt 2
            Q.reject new ApiError 'While downloading file, wrong statusCode returned', statusCode

          if /image/.test response.headers['content-type']
            outputStream = fs.createWriteStream file
            outputStream.on 'error', (error) ->
              Q.reject new RejectError 'While writing to file', error

            outputStream.on 'finish', ->
              log.info "✔ #{url} (#{statusCode}) -> #{file}\n"
              Q.resolve statusCode

            req.pipe outputStream

main = ->
  res = options.parse()

Q = require 'q'
mkdirp = require 'mkdirp'
URL = require 'url'
bhttp = require 'bhttp'

{ApiError, RejectError} = require './eh'
{log, pick, findInSubArray} = require './utils'
options = require './options'
{allDone, promiseRetry} = require './promise-helpers'

# Some common redefinitions
readFile = Q.nfbind fs.readFile
writeFile = Q.nfbind fs.writeFile
statFile = Q.nfbind fs.stat

get = (uri, method='GET') ->
  opts =
