     setValue: (newValue) ->
       @selectChoiceByValue newValue
       @getValue()
+
+    # destroy this instance of the plugin
+    destroy: ->
+      #remove event listeners
+      @element.off 'keyup change search', @doQuery
+      @element.off 'keydown', @doSelection
+      @element.off 'blur', @revert
+      $(window).off 'resize', @reposition
+
+      @queryResultArea.remove() # removes query result area and all related event listeners
+      $.removeData @element[0], "plugin_#{pluginName}" # remove reference to plugin instance
 
   $.fn[pluginName] = (options) ->
     args = Array.prototype.slice.call(arguments, 1)

        @selectedChoice = null
      @display()

    # return array of choices
    getChoices: ->
      @choices

        if options? and typeof options is 'string'
          plugin = $.data(this, "plugin_" + pluginName)
          method = options
          if method in plugin.publicMethods
            outputs.push plugin[method].apply plugin, args
          else
            throw new Error "#{pluginName} has no method '#{method}'"
      else
        outputs.push $.data this, "plugin_" + pluginName, new ImmyBox this, options

