   class Lock
     postfix: '-better-bibtex-locked'
 
-    constructor: ->
-      @decks = {}
-      for id in [ 'zotero-items-pane-content', 'zotero-item-pane-content' ]
-        @decks[id] = {
-          element: document.getElementById(id)
-          id: id
-        }
-        @decks[id].selected = @decks[id].element.selectedIndex
-        do (deck = @decks[id]) =>
-          @hide(deck.element)
-          deck.observer = new MutationObserver((mutations) => @hide(deck.element))
-          deck.observer.observe(deck.element, {attributes: true, childList: true})
-          return
+    lock: Zotero.Promise.coroutine((msg)->
+      #@decks = {}
+      #for id in [ 'zotero-items-pane-content', 'zotero-item-pane-content' ]
+      #  @decks[id] = {
+      #    element: document.getElementById(id)
+      #    id: id
+      #  }
+      #  @decks[id].selected = @decks[id].element.selectedIndex
+      #  do (deck = @decks[id]) =>
+      #    @hide(deck.element)
+      #    deck.observer = new MutationObserver((mutations) => @hide(deck.element))
+      #    deck.observer.observe(deck.element, {attributes: true, childList: true})
+      #    return
+
+      yield Zotero.uiReadyPromise
+
+      yield Zotero.unlockPromise if Zotero.locked
+
+      Zotero.showZoteroPaneProgressMeter(msg || 'Initializing Better BibTeX...')
 
       @toggle(true)
 
+      return
+    )
+
+    update: (msg) ->
+      Zotero.showZoteroPaneProgressMeter(msg)
+      return
+
     unlock: ->
-      return unless @decks
-
-      for id, deck of @decks
-        deck.observer.disconnect()
-        deck.element.selectedIndex = deck.selected
-        deck.element.removeChild(document.getElementById(id + @postfix))
-      @decks = null
+      #return unless @decks
+
+      #for id, deck of @decks
+      #  deck.observer.disconnect()
+      #  deck.element.selectedIndex = deck.selected
+      #  deck.element.removeChild(document.getElementById(id + @postfix))
+      #@decks = null
+
+      Zotero.hideZoteroPaneOverlays()
 
       @toggle(false)
 

    yield Zotero.Schema.schemaUpdatePromise
    bench('Zotero.Schema.schemaUpdatePromise')

    progressWin.changeHeadline('BetterBibTeX: Initializing')

    yield DB.init()
    bench('DB.init()')

    yield Translators.init()
    bench('Translators.init()')

    # progressWin.changeHeadline('BetterBibTeX: Ready for business')
    # progressWin.startCloseTimer(500)

    # should be safe to start tests at this point. I hate async.

