                     scroll_to(gui.primary_panel.dom)
                     set_panel_initial_focus gui.primary_panel.dom
             when '\r'
-                gui.primary_panel.dom.find('.panel-collapse').collapse('toggle')
+                $(gui.primary_panel.dom).find('.panel-collapse').collapse('toggle')
                 scroll_to(gui.primary_panel.dom)
                 #TODO For some reason I think I might be doing the line below twice
                 wait_if_else .1,

        $.when(append_bucket_item_panel(num_bucket_items, bucket_item, false)).then ->
            gui.primary_panel.change $('#sortable-bucket-item-list').find('.panel:last')
            if bucket_item_type != 'Person'
                populate_new_panel_dropup(gui.primary_panel.dom.find('.panel-dropup'))
            gui.primary_panel.focus_first_input()

$(document).on 'click', '#plus-button-group > div > button', ->

                else
                    if gui.primary_panel.dom.next().length != 0
                        gui.primary_panel.change(gui.primary_panel.dom.next())
                    if $(gui.primary_panel.dom).find('.panel_collapse').hasClass('in')
                        set_panel_initial_focus gui.primary_panel.dom
            when 'K'
                if not current_dropdown_item and not $('.bucket-dropdown').hasClass('open')
