     for band in @bands
       @dfs[band] = new $.Deferred()
     
+    # Create deferred and set up callback for error handling
+    errDfd = new $.Deferred()
+    
+    $.when(errDfd)
+      .done(@onError)
+    
     # Set callback for when all channels and astrojs libraries received
     dfs = $.map(@dfs, (v, k) -> v)
     $.when.apply(null, dfs)
       .done(@allChannelsReceived)
     
-    # Check cache for data
-    if prefix of @cache
-      cache = @cache[prefix]
+    if 'prefix' of @cache and Object.keys(@cache.prefix).length > 0
+      cache = @cache['prefix']
       
       # Load files from cache
       for band, index in @bands

            @wfits.loadImage(band, arr, width, height)
            
            # Cache some data
            @cache[prefix][band].min = min
            @cache[prefix][band].max = max
            @cache[prefix][band].arr = arr
            @cache[prefix][band].width = width
            @cache[prefix][band].height = height
            @cache[prefix][band].calibration = calibration
            
            @dfs[band].resolve()
          )
  
  # NOTE: Using exposure time = 1.0
  getCalibration: (header) ->


class Viewer extends Controller
  dimension: 441
  bands:  ['g', 'r', 'i']
  source: 'http://spacewarps.org.s3.amazonaws.com/subjects/raw/'
  
  cache: {}
  
  parameters:
    0:
      alpha: 0.09
