     chrome.extension.onMessage.addListener((request, sender, sendResponse) =>
       console.log "redirecting a message to #{request.module}"
       switch(request.module)
-        when "storageManager" then @storageManager.onMessage request.message, sender, sendResponse
-        when "navigationListener" then @navigationListener.onMessage request.message, sender, sendResponse
-        when "documentPreprocessor" then @DocumentPreprocessorPool.onMessage request.message, sender, sendResponse if @state is "on"
-        when "DSLProcessor" then @dslProcessor.onMessage request.message, sender, sendResponse
-        when "background" then @onMessage request.message, sender, sendResponse
-        when "userStudyToolbox" then @userStudyToolbox.onMessage request.message, sender, sendResponse
+        when "storageManager"
+          @storageManager.onMessage request.message, sender, sendResponse
+        when "navigationListener"
+          @navigationListener.onMessage request.message, sender, sendResponse
+        when "documentPreprocessor"
+          if @state is "on"
+            @DocumentPreprocessorPool.onMessage request.message, sender, sendResponse 
+        when "DSLProcessor"
+          @dslProcessor.onMessage request.message, sender, sendResponse
+        when "background"
+          @onMessage request.message, sender, sendResponse
+        when "userStudyToolbox"
+          @userStudyToolbox.onMessage request.message, sender, sendResponse
         else console.log "Could not redirect the message from the popup user interface. #{request.module} is not a valid module"
       #the listener must return true if the response needs to be sent asynchronously
       return true)
+    console.log "Message listener ready"
     return
 
 background = new mem0r1es.Background

    if @state is "on"
      @deactivate sendResponse
    else if @state is "off"
      @init sendResponse
  
  getState : (sendResponse) ->
    if @state is "on"

window.mem0r1es = {} if not window.mem0r1es?

class window.mem0r1es.Background
  init : () ->
    console.log "initializing mem0r1es"
    #open and initialize the database
    @storageManager = new mem0r1es.StorageManager()
    @storageManager.openDB()
    
    #Create the icon for the popup
    @icon = new mem0r1es.Icon()
