         event.preventDefault() if @annotationsHidden
 
     onClickToggleAnnotations: (e) =>
-        toggle = @$(@toggleSelector)
-        spans = @$(@spanSelector)
-
-        @annotationsHidden = !@annotationsHidden
-        if @annotationsHidden
-            spans.toggleClass('hide', true)
-            toggle.text('Show Annotations')
-            @visibleTips = @getVisibleTips()
-            @hideTips(@visibleTips)
-        else
-            spans.toggleClass('hide', false)
-            toggle.text('Hide Annotations')
-            @showTips(@visibleTips)
+        @annotationsHidden = not @annotationsHidden
+        @toggleButtonText @annotationsHidden
+        @toggleSpans @annotationsHidden
+        @toggleTips @annotationsHidden
 
     onClickReply: (e) =>
         hash = $(e.currentTarget).attr('href')
         if hash?.charAt(0) == '#'
             name = hash.substr(1)
             anchor = $("a[name='#{name}']").first()
-            @scrollTo(anchor) if anchor.length == 1
+            @scrollTo(anchor)
 
-    scrollTo: (el, padding = 20) ->
-        props =
-            scrollTop: (el.offset().top - padding)
-        opts =
+    toggleTips: (hide) ->
+        if hide
+            @closeAndSaveTips()
+        else
+            @openSavedTips()
+
+    toggleButtonText: (hide) ->
+        buttonText = (if hide then 'Show' else 'Hide')+' Annotations'
+        @$(@toggleSelector).text(buttonText)
+
+    toggleSpans: (hide) ->
+        @$(@spanSelector).toggleClass 'hide', hide
+
+    scrollTo: (el) ->
+        options =
             duration: 500
-            complete: @_once -> el.effect 'highlight', {}, 2000
-
-        $('html,body').animate(props, opts)
+            onAfter: @_once -> el.effect 'highlight', {}, 2000
+        $('html,body').scrollTo(el, options)
 
     makeTipContent: (el) ->
         (api) =>
+            anchor = $(el).data('discussion-anchor')
             comment = $(@commentSelector, el).first().clone()
-            anchor = $(el).data('discussion-anchor')
-            if anchor
-                comment.append(@createReplyLink(anchor))
+            comment.append(@createReplyLink(anchor)) if anchor
             comment.contents()
 
     makeTipTitle: (el) ->

        @$(@wrapperSelector).delegate @replySelector, 'click', @onClickReply

    initTips: () ->
        @visibleTips = []
        @$(@spanSelector).each (index, el) =>
            $(el).qtip(@getTipOptions el)

        @$(@helpSelector).qtip
            position:
                my: 'right top'

            if tip.is(':visible')
                visible.push [el, tip.offset()]
        visible

    hideTips: (pairs) ->
        elements = (pair[0] for pair in pairs)
        $(elements).qtip('hide')

    showTips: (pairs) ->
        $.each pairs, (index, pair) ->
            [el, offset] = pair
            $(el).qtip('show')
            api = $(el).qtip('api')
            $(api?.elements.tooltip).offset(offset)
 
    _once: (fn) ->
