 
   key_emitter = new KeyEmitter
   do key_emitter.listen
-  keyhandler = new KeyHandler view, keyBindings
-  key_emitter.on 'keydown', keyhandler.handleKey.bind(keyhandler)
+  key_handler = new KeyHandler view, key_bindings
+  key_emitter.on 'keydown', key_handler.handleKey.bind(key_handler)
+
+  # expose globals, for debugging
+  window.view = view
+  window.key_handler = key_handler
+  window.key_emitter = key_emitter
+  window.key_bindings = key_bindings
 
   $(document).ready ->
     do view.hideSettings

        content = view.exportContent mimetype
        download_file filename, mimetype, content
        view.showMessage "Exported to #{filename}!", {text_class: 'success'}

if chrome?.storage?.sync
  Logger.logger.info 'using chrome storage'

  settings = new Settings data.store, {mainDiv: $('#settings'), keybindingsDiv: $('#keybindings')}
  do settings.loadRenderSettings

  key_bindings = new KeyBindings settings, {modebindingsDiv: $('#keybindings')}

  view = new View data, {
    bindings: key_bindings
    settings: settings
    mainDiv: $('#view'),
    settingsDiv: $('#settings')
