 window.mem0r1es = {} if not window.mem0r1es?
 
 class window.mem0r1es.Background
-  init : (sendResponse = null) ->
-    console.log "activating mem0r1es"
+  init : () ->
+    console.log "initializing mem0r1es"
     #open and initialize the database
-    if not @state?
-      @storageManager = new mem0r1es.StorageManager()
-      @storageManager.openDB()
+    @storageManager = new mem0r1es.StorageManager()
+    @storageManager.openDB()
     
     #Create the icon for the popup
     @icon = new mem0r1es.Icon()

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

    @navigationListener = new mem0r1es.NavigationListener()
    
    #Initialize the DSL processor
    @dslProcessor = new mem0r1es.DSLProcessor @storageManager
    
    #Initialize the document preprocessor pool
    @DocumentPreprocessorPool = new mem0r1es.DocumentPreprocessorPool @storageManager
      
    #Initialize the navigation listener
    @userStudyToolbox = new mem0r1es.UserStudyToolbox @storageManager
    
    #Initialize the message listener
    @setupMessageListener()
    
    @state = "on"
  
  activate : (sendResponse = null) ->
    console.log "reactivating mem0r1es"
    @icon = new mem0r1es.Icon()
    @navigationListener = new mem0r1es.NavigationListener()
    @state = "on"
    if sendResponse?
      sendResponse {status : "ok", text: "Go incognito"}
    
  deactivate : (sendResponse = null) ->
    console.log "deactivating mem0r1es"
    #modify the icon for the popup
