   # Gets another task from the current challenge, close to the
   # location (if supplied)
   ###
-  near = "#{map.getCenter().lat},#{map.getCenter().lon}" if not near
-  url = "/api/challenges/#{challenge.slug}/tasks?near=#{near}"
+  near = "#{map.getCenter().lat},#{map.getCenter().lng}" if not near
+  url = "/api/challenges/#{challenge}/task?near=#{near}"
   $.getJSON url, (data) ->
     currentTask = data
-    currentTask.startTime = new Date.getTime()
+    currentTask.startTime = new Date().getTime()
     showTask(data)
 
 changeMapLayer = (layerUrl, layerAttrib = tileAttrib) ->

  ###
  # Takes dialog box data and returns a dialog box for nextUp actions
  ###
  dlg = $('<div></div>').addclass("dlg")
  dlg.append(markdown.toHTML(dlgData.text))
  buttons = $('div').addclass("buttons")
  for item in dlgData.buttons
    button = $('div').addclass("button")
    button.attr {onclick: "#{item.action}"}
    button.content(item.label)
    buttons.append(button)

  # Get the stats for the challenge and display the count of remaining
  # tasks
  ###
  $.getJSON "/api/challenges/#{challenge}/stats", (data) ->
    remaining = data.stats.total - data.stats.done
    $("#counter").text remaining

updateChallenge = (challenge) ->
  ###
  # Use the current challenge metadata to fill in the web page
  ###
  $.getJSON "/api/challenges/#{challenge}/meta", (data) ->
    currentChallenge = data.challenge
    $('#challengeDetails').text currentChallenge.name
    if data.tileurl? and data.tileurl != tileURL
      tileURL = data.tileurl
      tileAttrib = data.tileasttribution if data.tileattribution?
      changeMapLayer(tileURL, tileAttrib)
    currentChallenge.help = markdown.makeHtml(currentChallenge.help)
    currentChallenge.doneDlg = makeDlg(currentChallenge.doneDlg)


enableKeyboardShortcuts = ->
