   # tasks
   ###
   request = $.ajax {url:  "/api/c/challenges/#{challenge}/stats"}
-  request.done((data) ->
+  request.done (data) ->
     remaining = data.stats.total - data.stats.done
-    $("#counter").text remaining)
-  request.fail(ajaxErrorHandler)
+    $("#counter").text remaining
+  request.fail (ajaxErrorHandler)
 
 updateChallenge = (challenge) ->
   ###
   # Use the current challenge metadata to fill in the web page
   ###
-  request = $.ajax(url: "/api/c/challenges/#{challenge}")
-  request.done(data ->
+  request = $.ajax {url: "/api/c/challenges/#{challenge}"}
+  request.done (data) ->
     currentChallenge = data.challenge
     $('#challengeDetails').text currentChallenge.name
     if data.tileurl? and data.tileurl != tileURL

  # Gets a specific challenge
  ###
  request = $.ajax {url: "/api/c/challenges/#{id}"}
  request.done((data) ->
    challenge = data
    updateChallenge(challenge)
    updateStats(challenge)
    getTask())
  request.fail(ajaxErrorHandler)

@getNewChallenge = (difficulty, near) ->
  ###

  near = "#{map.getCenter().lng}|#{map.getCenter().lat}" if not near
  url = "/api/c/challenges/#{challenge}/tasks?near=#{near}"
  request = $.ajax {url: url}
  request.done (data) ->
    currentTask = data[0]
    showTask(data[0])
  request.fail (ajaxErrorHandler)

changeMapLayer = (layerUrl, layerAttrib = tileAttrib) ->
  ###
