     template: TEMPLATE
 
     map: null
+    userLayer: null
     scoreboard: null
 
     elements: $.extend

  $ = require 'jQuery'

  User = require 'zooniverse/models/User'
  ZooniverseProfile = require 'zooniverse/controllers/Profile'

  Map = require 'zooniverse/controllers/Map'

    userChanged: =>
      super

      @map.removeLayer @userLayer if @userLayer?

      if User.current?
        @usernameContainer.html User.current.name
        @scoreboard.update()

        query = "SELECT * FROM #{Project.current.cartoTable} WHERE user_id='#{User.current.id}'"
        url = "http://#{Project.current.cartoUser}.cartodb.com/tiles/#{Project.current.cartoTable}/{z}/{x}/{y}.png?sql=#{query}"
        @userLayer = @map.addLayer url

    favoriteTemplate: favoriteTemplate

  module.exports = Profile
