 
       check = -> remove() if !(inTarget || inTooltip)
       remove = ->
-        console.log 'remove', uidStr, instId
         delete instances[instId]
         cfg.rmTooltip $el, $target, $tooltip
         $target.removeData(uidStr)
-
-      setTargetHover = (state) ->
-        inTarget = state
-        check()
+      $target.on 'remove', remove
 
       instances[instId] =
         remove: remove
-        setTargetHover: setTargetHover
+        setTargetHover: (state) -> inTarget = state; check()
 
       $target.data(uidStr, instId)
 


  ttCounter = 0

  Backbone.Factlink.TooltipJQ = (cfg) ->
    uid = ttCounter++
    uidStr = 'tooltipUid-' + uid

      selector: 'a'
      mkTooltip: ($el, $target) ->
        $('<span class="testTooltip">This is a <a href="#">Link!</a></span>')
          .append($('<b>kill</b>').on('click', (e) ->
            e.stopPropagation()
            $target.remove()))
          .insertAfter($target)
      rmTooltip: ($el, $target, $tooltip) ->
        $tooltip.remove()
