     else
         return $('html')
 
-removeClassPrefix = ($el, prefix) ->
+removePrefixedClasses = ($el, prefix) ->
     $el.attr 'class', (index, className) ->
         className.replace(new RegExp("\\b#{ prefix }\\S+", 'g'), '').replace(/\s+/g, ' ')
 
 $ ->
-
     drop.updateBodyClasses()
 
     $(document).on 'openDrop.drop, closeDrop.drop', (event) -> drop.updateBodyClasses()
 
-    resizePending = false
-    $(window).on 'resize', ->
-        return if resizePending
-        resizePending = true
-        if debounce is 0
-            resizePending = false
-            drop.positionAll()
-        else
-            setTimeout ->
-                resizePending = false
-                drop.positionAll()
-            , debounce
-
-    scrollPending = false
-    $(window).on 'scroll.drop', ->
-        return if scrollPending
-        scrollPending = true
-        if debounce is 0
-            scrollPending = false
-            drop.positionAll()
-        else
-            setTimeout ->
-                scrollPending = false
-                drop.positionAll()
-            , debounce
+    $(window).on 'resize', debounce(-> drop.positionAll())
+    $(window).on 'scroll.drop', debounce(-> drop.positionAll())
 
 drop =
 


        $([$target[0], options.$drop[0]]).each ->
            $el = $(@)
            removeClassPrefix($el, drop.baseClassNames.attachPrefix)
            $el.addClass("#{ drop.baseClassNames.attachPrefix }#{ attachFirst }-#{ attachSecond }")

    positionDrop: ->

                setTimeout ->
                    scrollPending = false
                    position()
                , DEBOUNCE

        if options.trigger is 'click'
            $target.bind 'click.drop', -> $target.drop 'toggleDrop'
