     @wfits.setQ(value)
     
   updateScale: (band, value) =>
-    @wfits.setScale(band, value)
+    scales = @collection.getColorScales()
+    index = if band is 'i' then 0 else if band is 'g' then 1 else 2
+    console.log 'index = ', index
+    scales[index] = value
+    @wfits.setScales.apply(@wfits, scales)
   
   updateStretch: (value) =>
+    @stretch = value
     @wfits.setStretch(value)
+    @wfits.draw()
 
 
 window.Ubret.SpacewarpViewer = SpacewarpViewer

    $.when.apply(this, dfs)
      .done( (e) =>
        @computeNormalizedScales()
        [g, r, i] = @collection.getColorLayers()
        iScale = i.get('nscale')
        rScale = r.get('nscale')
        gScale = g.get('nscale')
        
        @wfits.setAlpha(@defaultAlpha)
        @wfits.setQ(@defaultQ)
        @wfits.setScales(iScale, rScale, gScale)
        @wfits.setupControls()
        
        # Set color composite as default

        maxs = @collection.map( (l) -> return l.get('maximum'))
        globalMin = Math.min.apply(Math, mins)
        globalMax = Math.max.apply(Math, maxs)
        @wfits.setExtent(globalMin, globalMax)
      
      @wfits.setImage(band)
      @wfits.setStretch(@stretch)

    # Call draw function
    @wfits[fn]()
