   ###
   # Playlists management.
   ###
-  class Playlists
+  class Playlists extends Component
     playlists = []
     activePlaylist = null
-    queue = []
-    initialized = false
 
     @initialize: ->
-      playlists = API.getPlaylists().map (playlist) ->
-        return new Playlist(playlist)
-      activePlaylist = @getActivated()
-
       API.getPlaylists (_playlists) => # Retrieve id as well.
         playlists = _playlists.map (playlist) ->
           return new Playlist(playlist)
 
         activePlaylist = @getActivated()
-        initialized = true
-        queue.forEach (callback) -> callback()
-
-    @afterInitialization: (callback) ->
-      if initialized then callback()
-      else queue.push callback
+        @done()
 
     @getEnabled: ->
       return playlists.filter (playlist, index) -> return playlist.enabled

      setTimeout @start, INITIALIZATION_TIMEOUT

  initialize = ->
    console.log 'Plugmixer.initialize'
    Listener.initializeWindowMessage()
    User.initialize()
    Youtube.preInitialize()

    if TRACKING_CODE?

      return list[timestamp]

    class Card
      @initialize: ->
        $('#plugmixer-save-new').click (event) => expandNew()
        $('#plugmixer-selection-cancel').click (event) => collapseNew()
        $('#plugmixer-input').keyup (event) =>
          if event.keyCode == 13 then @addNew() # Enter key.

      @addNew: ->
        selection = Selections.add $('#plugmixer-input').val()
        collapseNew()
        ga 'plugmixer.send', 'event', 'group', 'enter'
      collapseNew = ->
        $('#plugmixer-input').blur() # Otherwise the interface will bug out.
        $('#plugmixer-new-selection').addClass 'plugmixer-hide'
        $('#plugmixer-save-new').prop 'disabled', false
      expandNew = ->
        $('#plugmixer-new-selection').removeClass 'plugmixer-hide'
        $('#plugmixer-save-new').prop 'disabled', true
        $('#plugmixer-input').focus()
