     
     # Set various deferred objects to handle asynchronous requests.
     @dfs =
-      webfits: new $.Deferred()
       u: new $.Deferred()
       g: new $.Deferred()
       r: new $.Deferred()
       i: new $.Deferred()
       z: new $.Deferred()
+
+
+    @dfWebfits = new $.Deferred()
     
     @getApi()
   

    lib = if context? then 'gl' else 'canvas'
    url = "javascripts/webfits-#{lib}.js"
    $.getScript(url, =>
      @dfs.webfits.resolve()
    )
  
  getNextSubject: =>

  
  # Request FITS files for each channel
  requestChannels: ->
    @dfWebfits.then =>
      @initWebFITS()
    
      # Set various deferred objects to handle asynchronous requests.
      @dfs =
        u: new $.Deferred()
        g: new $.Deferred()
        r: new $.Deferred()
        i: new $.Deferred()
        z: new $.Deferred()
   
      subject = @currentPageData()[0]
      prefix  = subject.metadata.id
    
      # Set callback for when all channels and WebFITS Api received
      $.when.apply(null, _.values(@dfs))
        .done(@allChannelsReceived)
      
      for band, index in @bands
        do (band, index) =>
          path = "#{@source}#{prefix}_#{band}.fits.fz"
        
          new astro.FITS.File(path, (fits) =>
            hdu = fits.getHDU()
            header = hdu.header
            dataunit = hdu.data
          
            # Get image data
            dataunit.getFrameAsync(0, (arr) =>
            
              # Compute extent
              [min, max] = dataunit.getExtent(arr)

              # Initialize a model and push to collection
              layer = new Layer({band: band, fits: fits, minimum: min, maximum: max})
              @collection.add(layer)

              # Load texture
              @wfits.loadImage(band, arr, dataunit.width, dataunit.height)
              @dfs[band].resolve()
            )
          )
  
  # Initialize a WebFITS object
  initWebFITS: =>
    @wfits?.teardown()
   
    @wfits = new astro.WebFITS(@el, @dimension)
    
    unless @wfits.ctx?
