   ###
   near = "#{map.getCenter().lng}|#{map.getCenter().lat}" if not near
   url = "/api/c/challenges?difficulty=#{difficulty}&contains=#{near}"
-  request = $.ajax({
-    url:  "/api/c/challenges?difficulty=#{difficulty}&contains=#{near}"})
-  request.done((data) ->
+  request = $.ajax {url: "/api/c/challenges?difficulty=#{difficulty}&contains=#{near}"}
+  request.done (data) ->
     challenge = data.challenges[0]
     updateChallenge(challenge)
     updateStats(challenge)
-    getTask(near))
-  request.fail(ajaxErrorHandler)
+    getTask(near)
+  request.fail (ajaxErrorHandler)
 
 
 @getTask = (near = null) ->

  # 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) ->
  ###
