   # Build URL for API request.
   url = buildUrl(user.apiKey, id, resolution)
   
-  log.info 'Requesting information for image with ID ' \
-    + id \
+  log.info 'Requesting information for image' \
     + ' from ' \
-    + url
-    
-  # Call out to Pixabay.
+    + redactApiKey url
+    
   options =
     url: url
     json: true
+    
+  # Call out to Pixabay.
   request options, (error, response, body) ->
-    if error || !body || !body.hits
-      log.error 'Couldn\'t get information about image with ID \'' \
-        + id \
-        + '\''
-    else
+    
+    # On success.
+    if isSuccessful error, body
       url = body.hits[0][resolutions[resolution]]
-      log.info 'Downloading file from ' \
-        + url
+      log.info 'Downloading file from \'' \
+        + url \
+        + '\'...'
       tempDestination = destination + '.pickseltemp'
       file = fs.createWriteStream tempDestination
       req = https.get url, (response) ->

]


# Builds a URL for downloading image information.
#
# @param [String] apiKey the API key to use for the request

  jsonfile.writeFileSync './picksel.json', config, options

    
# Returns true if a request to the Pixabay API was successful.
#
# @param [Object] error any error returned with the response
# @param [Object] body the body of the response
#
isSuccessful = (error, body) -> 
  !error \
  && body \
  && body.hits \
  && body.hits instanceof Array \
  && body.hits.length > 0
  
    
# Downloads an image.
#
# @param [String] id the Pixabay image ID
