         @counter.increment('favorites')
     else
       alert ("Please sign in or make an account to save favourites.")
-  
+
   # Set up inline dashboard with current subject
   onDashboard: (e) ->
     e.preventDefault()
-    
+
     if @viewer?
       # Show mask and viewer
       @maskEl.addClass('show')
       @viewerEl.addClass('show')
-    
+
       # Load current subject
       @viewer.load(@classification.subject.metadata.id)
     else
       alert "Sorry this feature is not supported on IE."
-  
+
   # Enabled only when viewer is ready
   wheelHandler: (e) =>
     e.preventDefault()
-    
+
     # Get object and pipe event
     wfits = @viewer.wfits
     wfits.wheelHandler(e)
-    
+
     Annotation.zoom = wfits.getZoom() * wfits.width / 2
     for key, a of @annotations
       a.worldToLocal()
-  
+
   # Called when viewer is ready
   setupMouseControls: (e) =>
     svg = @svg[0]
-    
+
     # Activate annotate flag
     @isAnnotatable = false
-    
+
     # Update/reset Annotation class attributes
     Annotation.halfWidth = @viewer.wfits.width / 2
     Annotation.halfHeight = @viewer.wfits.height / 2
     Annotation.xOffset = @viewer.wfits.getXOffset()
     Annotation.yOffset = @viewer.wfits.getYOffset()
-    
+
     # Setup mouse controls on the SVG element
     svg.addEventListener('mousewheel', @wheelHandler, false)
     svg.addEventListener('DOMMouseScroll', @wheelHandler, false)
-    
+
     # Pass events to viewer
     svg.onmousedown = (e) =>
-      
+
       # Store the down position for later comparison
       @xDown = e.pageX
       @yDown = e.pageY
-      
+
       return if Annotation.drag
-      
+
       @viewer.wfits.canvas.onmousedown(e)
-      
+
     svg.onmouseup = (e) =>
-      
+
       # Propagate to annotation layer if down coordinates match up coordinates
       if @xDown is e.pageX and @yDown is e.pageY
         @isAnnotatable = true
       else
         @isAnnotatable = false
       return if @viewer.wfits.drag is false
-      
+
       @viewer.wfits.canvas.onmouseup(e)
-      
+
     svg.onmousemove = (e) =>
       # Pass event to WebFITS object
       @viewer.wfits.canvas.onmousemove(e)
-      
+
       return if Annotation.drag
-      
+
       if @viewer.wfits.drag
         # Update Annotation class attributes
         Annotation.xOffset = @viewer.wfits.getXOffset()
         Annotation.yOffset = @viewer.wfits.getYOffset()
-        
+
         # Redraw element within pan-zoom reference frame
         for key, a of @annotations
           a.worldToLocal()
-        
+
     svg.onmouseout = (e) =>
       @viewer.wfits.canvas.onmouseout(e)
     svg.onmouseover = (e) =>
       @viewer.wfits.canvas.onmouseover(e)
-  
+
   onViewerClose: (e) =>
-    
+
     @maskEl.removeClass('show')
     @viewerEl.removeClass('show')
-    
+
     # Allow annotation again
     @isAnnotatable = true
-    
+
     # Reset Annotation attributes
     Annotation.xOffset = -220.5
     Annotation.yOffset = -220.5
     Annotation.zoom = 1
-    
+
     # Redraw in world frame
     for key, a of @annotations
       a.worldToLocal()
-    
+
     # Tear down mouse events
     $(document).keyup(null)
     $(document).keydown(null)
-    
+
     svg = @svg[0]
     svg.removeEventListener('mousewheel', @wheelHandler, false)
     svg.onmousedown = null

      @removeOnCount -= 1
      @toggleRemoveAll()
    )
    
    # Trigger event with annotation object
    @trigger 'onAnnotation', annotation
    
    # Replace text on interface
    unless @hasAnnotation
      @el.find('.current [data-type="finish"]').text('Finished marking!')
      @hasAnnotation = true
    
    # Update stats
    if @annotationCount is 1
      @counter.increment('potentials')
    
    # Warn of overmarking
    if (@annotationCount > @maxAnnotations) and (Math.random() > 0.4) and (not @hasWarned)
      @warningDialog.open()
      @hasWarned = true
  
  toggleRemoveAll: (e) ->
    if @removeOnCount > 0
      @removeAllEl.addClass('show')
    else
      @removeAllEl.removeClass('show')
  
  removeAnnotations: (e) =>
    @stopPropagation(e)
    
    for key, annotation of @annotations
      annotation.remove()
  
  removeAnnotation: (annotation) =>
    
    # Remove event bindings
    annotation.unbind()
    
    index = annotation.index
    delete @annotations[index]
    
    # Update stats
    @annotationCount -= 1
    if @annotationCount is 0
      @counter.decrement('potentials')
    
    # Update finish text if necessary
    count = _.keys(@annotations).length
    if count is 0
      @el.find('.current [data-type="finish"]').text('Next!')
      @hasAnnotation = false
  
  # Check if volunteer marked a simulated lens
  checkImageMask: (x, y) =>
    try

        else
          # User's machine triggers errors when checking pixel mask, so move on to the next subject
          @submit(e)

      else if trainingType is 'empty'

        # Count the number of annotations
        nAnnotations = _.keys(@annotations).length

        @tutorial = if nAnnotations > 0 then @createDudMissedFeedback(e) else @createDudFoundFeedback(e)

      # Start the tutorial
      if @tutorial?
        @tutorial.el.on 'start-tutorial enter-tutorial-step', =>
          translate.refresh @tutorial.el.get 0

        @tutorial.start()

    else
      @submit(e)

