diff --git a/src/api.py b/src/api.py
index 70da0cda..446c6ae4 100644
--- a/src/api.py
+++ b/src/api.py
@@ -27,6 +27,7 @@ import queues
 import shared
 import shutdown
 import state
+import threads
 from addresses import (
     addBMIfNotPresent,
     calculateInventoryHash,
@@ -1206,7 +1207,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
                 len(encryptedPayload) + requiredPayloadLengthExtraBytes + 8
             ) * requiredAverageProofOfWorkNonceTrialsPerByte
         )
-        with shared.printLock:
+        with threads.printLock:
             print(
                 '(For msg message via API) Doing proof of work.'
                 'Total required difficulty:',
@@ -1221,7 +1222,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
         powStartTime = time.time()
         initialHash = hashlib.sha512(encryptedPayload).digest()
         trialValue, nonce = proofofwork.run(target, initialHash)
-        with shared.printLock:
+        with threads.printLock:
             print '(For msg message via API) Found proof of work', trialValue, 'Nonce:', nonce
             try:
                 print(
@@ -1240,7 +1241,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
             objectType, toStreamNumber, encryptedPayload,
             int(time.time()) + TTL, ''
         )
-        with shared.printLock:
+        with threads.printLock:
             print 'Broadcasting inv for msg(API disseminatePreEncryptedMsg command):', hexlify(inventoryHash)
         queues.invQueue.put((toStreamNumber, inventoryHash))
 
@@ -1294,7 +1295,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
         Inventory()[inventoryHash] = (
             objectType, pubkeyStreamNumber, payload, int(time.time()) + TTL, ''
         )
-        with shared.printLock:
+        with threads.printLock:
             print 'broadcasting inv within API command disseminatePubkey with hash:', hexlify(inventoryHash)
         queues.invQueue.put((pubkeyStreamNumber, inventoryHash))
 
@@ -1347,15 +1348,15 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
         connections_num = len(network.stats.connectedHostsList())
         if connections_num == 0:
             networkStatus = 'notConnected'
-        elif shared.clientHasReceivedIncomingConnections:
+        elif state.clientHasReceivedIncomingConnections:
             networkStatus = 'connectedAndReceivingIncomingConnections'
         else:
             networkStatus = 'connectedButHaveNotReceivedIncomingConnections'
         return json.dumps({
             'networkConnections': connections_num,
-            'numberOfMessagesProcessed': shared.numberOfMessagesProcessed,
-            'numberOfBroadcastsProcessed': shared.numberOfBroadcastsProcessed,
-            'numberOfPubkeysProcessed': shared.numberOfPubkeysProcessed,
+            'numberOfMessagesProcessed': state.numberOfMessagesProcessed,
+            'numberOfBroadcastsProcessed': state.numberOfBroadcastsProcessed,
+            'numberOfPubkeysProcessed': state.numberOfPubkeysProcessed,
             'networkStatus': networkStatus,
             'softwareName': 'PyBitmessage',
             'softwareVersion': softwareVersion
diff --git a/src/bitmessagecurses/__init__.py b/src/bitmessagecurses/__init__.py
index d8daeef7..17dba22b 100644
--- a/src/bitmessagecurses/__init__.py
+++ b/src/bitmessagecurses/__init__.py
@@ -24,6 +24,7 @@ import network.stats
 import queues
 import shared
 import shutdown
+import state
 
 from addresses import addBMIfNotPresent, decodeAddress
 from bmconfigparser import BMConfigParser
@@ -274,11 +275,11 @@ def drawtab(stdscr):
             # Uptime and processing data
             stdscr.addstr(6, 35, "Since startup on " + l10n.formatTimestamp(startuptime, False))
             stdscr.addstr(7, 40, "Processed " + str(
-                shared.numberOfMessagesProcessed).ljust(4) + " person-to-person messages.")
+                state.numberOfMessagesProcessed).ljust(4) + " person-to-person messages.")
             stdscr.addstr(8, 40, "Processed " + str(
-                shared.numberOfBroadcastsProcessed).ljust(4) + " broadcast messages.")
+                state.numberOfBroadcastsProcessed).ljust(4) + " broadcast messages.")
             stdscr.addstr(9, 40, "Processed " + str(
-                shared.numberOfPubkeysProcessed).ljust(4) + " public keys.")
+                state.numberOfPubkeysProcessed).ljust(4) + " public keys.")
 
             # Inventory data
             stdscr.addstr(11, 35, "Inventory lookups per second: " + str(inventorydata).ljust(3))
diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py
index d6cb289b..d9a7c7f5 100755
--- a/src/bitmessagemain.py
+++ b/src/bitmessagemain.py
@@ -51,9 +51,8 @@ from network import (
 from singleinstance import singleinstance
 # Synchronous threads
 from threads import (
-    set_thread_name, addressGenerator, objectProcessor, singleCleaner,
-    singleWorker, sqlThread
-)
+    set_thread_name, printLock,
+    addressGenerator, objectProcessor, singleCleaner, singleWorker, sqlThread)
 
 
 def connectToStream(streamNumber):
@@ -157,7 +156,7 @@ def signal_handler(signum, frame):
     logger.error("Got signal %i", signum)
     # there are possible non-UI variants to run bitmessage
     # which should shutdown especially test-mode
-    if shared.thisapp.daemon or not state.enableGUI:
+    if state.thisapp.daemon or not state.enableGUI:
         shutdown.doCleanShutdown()
     else:
         print('# Thread: %s(%d)' % (thread.name, thread.ident))
@@ -233,10 +232,10 @@ class Main(object):
                 ' \'-c\' as a commandline argument.'
             )
         # is the application already running?  If yes then exit.
-        shared.thisapp = singleinstance("", daemon)
+        state.thisapp = singleinstance("", daemon)
 
         if daemon:
-            with shared.printLock:
+            with printLock:
                 print('Running as a daemon. Send TERM signal to end.')
             self.daemonize()
 
@@ -413,7 +412,7 @@ class Main(object):
         try:
             if os.fork():
                 # unlock
-                shared.thisapp.cleanup()
+                state.thisapp.cleanup()
                 # wait until grandchild ready
                 while True:
                     time.sleep(1)
@@ -423,7 +422,7 @@ class Main(object):
             pass
         else:
             parentPid = os.getpid()
-            shared.thisapp.lock()  # relock
+            state.thisapp.lock()  # relock
 
         os.umask(0)
         try:
@@ -434,7 +433,7 @@ class Main(object):
         try:
             if os.fork():
                 # unlock
-                shared.thisapp.cleanup()
+                state.thisapp.cleanup()
                 # wait until child ready
                 while True:
                     time.sleep(1)
@@ -443,8 +442,8 @@ class Main(object):
             # fork not implemented
             pass
         else:
-            shared.thisapp.lock()  # relock
-        shared.thisapp.lockPid = None  # indicate we're the final child
+            state.thisapp.lock()  # relock
+        state.thisapp.lockPid = None  # indicate we're the final child
         sys.stdout.flush()
         sys.stderr.flush()
         if not sys.platform.startswith('win'):
@@ -483,7 +482,7 @@ All parameters are optional.
     @staticmethod
     def stop():
         """Stop main application"""
-        with shared.printLock:
+        with printLock:
             print('Stopping Bitmessage Deamon.')
         shutdown.doCleanShutdown()
 
diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py
index 440d36b2..88d41b7f 100644
--- a/src/bitmessageqt/__init__.py
+++ b/src/bitmessageqt/__init__.py
@@ -17,10 +17,11 @@ from sqlite3 import register_adapter
 from PyQt4 import QtCore, QtGui
 from PyQt4.QtNetwork import QLocalSocket, QLocalServer
 
+import shared
+import state
 from debug import logger
 from tr import _translate
 from addresses import decodeAddress, addBMIfNotPresent
-import shared
 from bitmessageui import Ui_MainWindow
 from bmconfigparser import BMConfigParser
 import namecoin
@@ -730,9 +731,6 @@ class MyForm(settingsmixin.SMainWindow):
         QtCore.QObject.connect(self.pushButtonStatusIcon, QtCore.SIGNAL(
             "clicked()"), self.click_pushButtonStatusIcon)
 
-        self.numberOfMessagesProcessed = 0
-        self.numberOfBroadcastsProcessed = 0
-        self.numberOfPubkeysProcessed = 0
         self.unreadCount = 0
 
         # Set the icon sizes for the identicons
@@ -1668,7 +1666,7 @@ class MyForm(settingsmixin.SMainWindow):
         if color == 'red':
             self.pushButtonStatusIcon.setIcon(
                 QtGui.QIcon(":/newPrefix/images/redicon.png"))
-            shared.statusIconColor = 'red'
+            state.statusIconColor = 'red'
             # if the connection is lost then show a notification
             if self.connected and _notifications_enabled:
                 self.notifierShow(
@@ -1694,7 +1692,7 @@ class MyForm(settingsmixin.SMainWindow):
                 self.statusbar.clearMessage()
             self.pushButtonStatusIcon.setIcon(
                 QtGui.QIcon(":/newPrefix/images/yellowicon.png"))
-            shared.statusIconColor = 'yellow'
+            state.statusIconColor = 'yellow'
             # if a new connection has been established then show a notification
             if not self.connected and _notifications_enabled:
                 self.notifierShow(
@@ -1712,7 +1710,7 @@ class MyForm(settingsmixin.SMainWindow):
                 self.statusbar.clearMessage()
             self.pushButtonStatusIcon.setIcon(
                 QtGui.QIcon(":/newPrefix/images/greenicon.png"))
-            shared.statusIconColor = 'green'
+            state.statusIconColor = 'green'
             if not self.connected and _notifications_enabled:
                 self.notifierShow(
                     'Bitmessage',
@@ -2119,7 +2117,7 @@ class MyForm(settingsmixin.SMainWindow):
                                 "MainWindow", "Concerning the address %1, Bitmessage cannot handle stream numbers of %2. Perhaps upgrade Bitmessage to the latest version.").arg(toAddress).arg(str(streamNumber)))
                             continue
                         self.statusbar.clearMessage()
-                        if shared.statusIconColor == 'red':
+                        if state.statusIconColor == 'red':
                             self.updateStatusBar(_translate(
                                 "MainWindow",
                                 "Warning: You are currently not connected."
@@ -2632,7 +2630,7 @@ class MyForm(settingsmixin.SMainWindow):
             elif reply == QtGui.QMessageBox.Cancel:
                 return
 
-        if shared.statusIconColor == 'red' and not BMConfigParser().safeGetBoolean(
+        if state.statusIconColor == 'red' and not BMConfigParser().safeGetBoolean(
                 'bitmessagesettings', 'dontconnect'):
             reply = QtGui.QMessageBox.question(
                 self, _translate("MainWindow", "Not connected"),
@@ -2660,7 +2658,7 @@ class MyForm(settingsmixin.SMainWindow):
         if waitForConnection:
             self.updateStatusBar(_translate(
                 "MainWindow", "Waiting for network connection..."))
-            while shared.statusIconColor == 'red':
+            while state.statusIconColor == 'red':
                 time.sleep(0.5)
                 QtCore.QCoreApplication.processEvents(
                     QtCore.QEventLoop.AllEvents, 1000
diff --git a/src/bitmessageqt/networkstatus.py b/src/bitmessageqt/networkstatus.py
index 6fbf5df6..59b97f77 100644
--- a/src/bitmessageqt/networkstatus.py
+++ b/src/bitmessageqt/networkstatus.py
@@ -11,7 +11,7 @@ from PyQt4 import QtCore, QtGui
 import knownnodes
 import l10n
 import network.stats
-import shared
+import state
 import widgets
 from inventory import Inventory
 from network import BMConnectionPool
@@ -108,7 +108,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
                 "Processed %n person-to-person message(s).",
                 None,
                 QtCore.QCoreApplication.CodecForTr,
-                shared.numberOfMessagesProcessed))
+                state.numberOfMessagesProcessed))
 
     def updateNumberOfBroadcastsProcessed(self):
         """Update the counter for the number of processed broadcasts"""
@@ -119,7 +119,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
                 "Processed %n broadcast message(s).",
                 None,
                 QtCore.QCoreApplication.CodecForTr,
-                shared.numberOfBroadcastsProcessed))
+                state.numberOfBroadcastsProcessed))
 
     def updateNumberOfPubkeysProcessed(self):
         """Update the counter for the number of processed pubkeys"""
@@ -130,7 +130,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
                 "Processed %n public key(s).",
                 None,
                 QtCore.QCoreApplication.CodecForTr,
-                shared.numberOfPubkeysProcessed))
+                state.numberOfPubkeysProcessed))
 
     def updateNumberOfBytes(self):
         """
@@ -225,9 +225,9 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
         # FYI: The 'singlelistener' thread sets the icon color to green when it
         # receives an incoming connection, meaning that the user's firewall is
         # configured correctly.
-        if self.tableWidgetConnectionCount.rowCount() and shared.statusIconColor == 'red':
+        if self.tableWidgetConnectionCount.rowCount() and state.statusIconColor == 'red':
             self.window().setStatusIcon('yellow')
-        elif self.tableWidgetConnectionCount.rowCount() == 0 and shared.statusIconColor != "red":
+        elif self.tableWidgetConnectionCount.rowCount() == 0 and state.statusIconColor != "red":
             self.window().setStatusIcon('red')
 
     # timer driven
diff --git a/src/bitmessageqt/settings.py b/src/bitmessageqt/settings.py
index bab27fbb..1f650fe7 100644
--- a/src/bitmessageqt/settings.py
+++ b/src/bitmessageqt/settings.py
@@ -11,7 +11,6 @@ import namecoin
 import openclpow
 import paths
 import queues
-import shared
 import state
 import tempfile
 import widgets
@@ -338,7 +337,7 @@ class SettingsDialog(QtGui.QDialog):
 
         proxytype_index = self.comboBoxProxyType.currentIndex()
         if proxytype_index == 0:
-            if self._proxy_type and shared.statusIconColor != 'red':
+            if self._proxy_type and state.statusIconColor != 'red':
                 self.net_restart_needed = True
         elif self.comboBoxProxyType.currentText() != self._proxy_type:
             self.net_restart_needed = True
@@ -482,7 +481,7 @@ class SettingsDialog(QtGui.QDialog):
             # default behavior. The input is blank/blank
             self.config.set('bitmessagesettings', 'stopresendingafterxdays', '')
             self.config.set('bitmessagesettings', 'stopresendingafterxmonths', '')
-            shared.maximumLengthOfTimeToBotherResendingMessages = float('inf')
+            state.maximumLengthOfTimeToBotherResendingMessages = float('inf')
             stopResendingDefaults = True
 
         try:
@@ -497,9 +496,9 @@ class SettingsDialog(QtGui.QDialog):
             months = 0.0
 
         if days >= 0 and months >= 0 and not stopResendingDefaults:
-            shared.maximumLengthOfTimeToBotherResendingMessages = \
+            state.maximumLengthOfTimeToBotherResendingMessages = \
                 days * 24 * 60 * 60 + months * 60 * 60 * 24 * 365 / 12
-            if shared.maximumLengthOfTimeToBotherResendingMessages < 432000:
+            if state.maximumLengthOfTimeToBotherResendingMessages < 432000:
                 # If the time period is less than 5 hours, we give
                 # zero values to all fields. No message will be sent again.
                 QtGui.QMessageBox.about(
@@ -516,7 +515,7 @@ class SettingsDialog(QtGui.QDialog):
                     'bitmessagesettings', 'stopresendingafterxdays', '0')
                 self.config.set(
                     'bitmessagesettings', 'stopresendingafterxmonths', '0')
-                shared.maximumLengthOfTimeToBotherResendingMessages = 0.0
+                state.maximumLengthOfTimeToBotherResendingMessages = 0.0
             else:
                 self.config.set(
                     'bitmessagesettings', 'stopresendingafterxdays', str(days))
diff --git a/src/class_objectProcessor.py b/src/class_objectProcessor.py
index 824580c2..f435d8d4 100644
--- a/src/class_objectProcessor.py
+++ b/src/class_objectProcessor.py
@@ -140,9 +140,9 @@ class objectProcessor(threading.Thread):
         # bypass nonce and time, retain object type/version/stream + body
         readPosition = 16
 
-        if data[readPosition:] in shared.ackdataForWhichImWatching:
+        if data[readPosition:] in state.ackdataForWhichImWatching:
             logger.info('This object is an acknowledgement bound for me.')
-            del shared.ackdataForWhichImWatching[data[readPosition:]]
+            del state.ackdataForWhichImWatching[data[readPosition:]]
             sqlExecute(
                 'UPDATE sent SET status=?, lastactiontime=?'
                 ' WHERE ackdata=?',
@@ -286,7 +286,7 @@ class objectProcessor(threading.Thread):
     def processpubkey(self, data):
         """Process a pubkey object"""
         pubkeyProcessingStartTime = time.time()
-        shared.numberOfPubkeysProcessed += 1
+        state.numberOfPubkeysProcessed += 1
         queues.UISignalQueue.put((
             'updateNumberOfPubkeysProcessed', 'no data'))
         readPosition = 20  # bypass the nonce, time, and object type
@@ -459,7 +459,7 @@ class objectProcessor(threading.Thread):
     def processmsg(self, data):
         """Process a message object"""
         messageProcessingStartTime = time.time()
-        shared.numberOfMessagesProcessed += 1
+        state.numberOfMessagesProcessed += 1
         queues.UISignalQueue.put((
             'updateNumberOfMessagesProcessed', 'no data'))
         readPosition = 20  # bypass the nonce, time, and object type
@@ -808,7 +808,7 @@ class objectProcessor(threading.Thread):
     def processbroadcast(self, data):
         """Process a broadcast object"""
         messageProcessingStartTime = time.time()
-        shared.numberOfBroadcastsProcessed += 1
+        state.numberOfBroadcastsProcessed += 1
         queues.UISignalQueue.put((
             'updateNumberOfBroadcastsProcessed', 'no data'))
         inventoryHash = calculateInventoryHash(data)
diff --git a/src/class_singleCleaner.py b/src/class_singleCleaner.py
index b9fe3d1c..e322574e 100644
--- a/src/class_singleCleaner.py
+++ b/src/class_singleCleaner.py
@@ -25,7 +25,6 @@ import time
 
 import knownnodes
 import queues
-import shared
 import state
 import tr
 from bmconfigparser import BMConfigParser
@@ -34,6 +33,13 @@ from inventory import Inventory
 from network import BMConnectionPool, StoppableThread
 
 
+#: Equals 4 weeks. You could make this longer if you want
+#: but making it shorter would not be advisable because
+#: there is a very small possibility that it could keep you
+#: from obtaining a needed pubkey for a period of time.
+lengthOfTimeToHoldOnToAllPubkeys = 2419200
+
+
 class singleCleaner(StoppableThread):
     """The singleCleaner thread class"""
     name = "singleCleaner"
@@ -44,7 +50,7 @@ class singleCleaner(StoppableThread):
         gc.disable()
         timeWeLastClearedInventoryAndPubkeysTables = 0
         try:
-            shared.maximumLengthOfTimeToBotherResendingMessages = (
+            state.maximumLengthOfTimeToBotherResendingMessages = (
                 float(BMConfigParser().get(
                     'bitmessagesettings', 'stopresendingafterxdays'))
                 * 24 * 60 * 60
@@ -56,7 +62,7 @@ class singleCleaner(StoppableThread):
             # Either the user hasn't set stopresendingafterxdays and
             # stopresendingafterxmonths yet or the options are missing
             # from the config file.
-            shared.maximumLengthOfTimeToBotherResendingMessages = float('inf')
+            state.maximumLengthOfTimeToBotherResendingMessages = float('inf')
 
         # initial wait
         if state.shutdown == 0:
@@ -74,7 +80,7 @@ class singleCleaner(StoppableThread):
             # queue which will never be handled by a UI. We should clear it to
             # save memory.
             # FIXME redundant?
-            if shared.thisapp.daemon or not state.enableGUI:
+            if state.thisapp.daemon or not state.enableGUI:
                 queues.UISignalQueue.queue.clear()
             if timeWeLastClearedInventoryAndPubkeysTables < \
                     int(time.time()) - 7380:
@@ -84,7 +90,7 @@ class singleCleaner(StoppableThread):
                 # pubkeys
                 sqlExecute(
                     "DELETE FROM pubkeys WHERE time<? AND usedpersonally='no'",
-                    int(time.time()) - shared.lengthOfTimeToHoldOnToAllPubkeys)
+                    int(time.time()) - lengthOfTimeToHoldOnToAllPubkeys)
 
                 # Let us resend getpubkey objects if we have not yet heard
                 # a pubkey, and also msg objects if we have not yet heard
@@ -94,7 +100,7 @@ class singleCleaner(StoppableThread):
                     " WHERE ((status='awaitingpubkey' OR status='msgsent')"
                     " AND folder='sent' AND sleeptill<? AND senttime>?)",
                     int(time.time()), int(time.time())
-                    - shared.maximumLengthOfTimeToBotherResendingMessages
+                    - state.maximumLengthOfTimeToBotherResendingMessages
                 )
                 for row in queryreturn:
                     if len(row) < 2:
@@ -131,7 +137,8 @@ class singleCleaner(StoppableThread):
                              ' is full. Bitmessage will now exit.'),
                          True)
                     ))
-                    if shared.thisapp.daemon or not state.enableGUI:
+                    # FIXME redundant?
+                    if state.thisapp.daemon or not state.enableGUI:
                         os._exit(1)
 
             # inv/object tracking
diff --git a/src/class_singleWorker.py b/src/class_singleWorker.py
index 6d7514d4..6e2522d8 100644
--- a/src/class_singleWorker.py
+++ b/src/class_singleWorker.py
@@ -94,25 +94,25 @@ class singleWorker(StoppableThread):
                         hexlify(privEncryptionKey))
                 )
 
-        # Initialize the shared.ackdataForWhichImWatching data structure
+        # Initialize the state.ackdataForWhichImWatching data structure
         queryreturn = sqlQuery(
             '''SELECT ackdata FROM sent WHERE status = 'msgsent' ''')
         for row in queryreturn:
             ackdata, = row
             self.logger.info('Watching for ackdata %s', hexlify(ackdata))
-            shared.ackdataForWhichImWatching[ackdata] = 0
+            state.ackdataForWhichImWatching[ackdata] = 0
 
         # Fix legacy (headerless) watched ackdata to include header
-        for oldack in shared.ackdataForWhichImWatching:
+        for oldack in state.ackdataForWhichImWatching:
             if len(oldack) == 32:
                 # attach legacy header, always constant (msg/1/1)
                 newack = '\x00\x00\x00\x02\x01\x01' + oldack
-                shared.ackdataForWhichImWatching[newack] = 0
+                state.ackdataForWhichImWatching[newack] = 0
                 sqlExecute(
                     'UPDATE sent SET ackdata=? WHERE ackdata=?',
                     newack, oldack
                 )
-                del shared.ackdataForWhichImWatching[oldack]
+                del state.ackdataForWhichImWatching[oldack]
 
         # give some time for the GUI to start
         # before we start on existing POW tasks.
@@ -864,7 +864,7 @@ class singleWorker(StoppableThread):
 
             # if we aren't sending this to ourselves or a chan
             if not BMConfigParser().has_section(toaddress):
-                shared.ackdataForWhichImWatching[ackdata] = 0
+                state.ackdataForWhichImWatching[ackdata] = 0
                 queues.UISignalQueue.put((
                     'updateSentItemStatusByAckdata', (
                         ackdata,
diff --git a/src/network/tcp.py b/src/network/tcp.py
index d611b1ca..18fd2e1a 100644
--- a/src/network/tcp.py
+++ b/src/network/tcp.py
@@ -14,7 +14,6 @@ import connectionpool
 import helper_random
 import knownnodes
 import protocol
-import shared
 import state
 from bmconfigparser import BMConfigParser
 from helper_random import randomBytes
@@ -34,6 +33,9 @@ from queues import invQueue, receiveDataQueue, UISignalQueue
 logger = logging.getLogger('default')
 
 
+maximumAgeOfNodesThatIAdvertiseToOthers = 10800  #: Equals three hours
+
+
 class TCPConnection(BMProto, TLSDispatcher):
     # pylint: disable=too-many-instance-attributes
     """
@@ -136,7 +138,7 @@ class TCPConnection(BMProto, TLSDispatcher):
     def set_connection_fully_established(self):
         """Initiate inventory synchronisation."""
         if not self.isOutbound and not self.local:
-            shared.clientHasReceivedIncomingConnections = True
+            state.clientHasReceivedIncomingConnections = True
             UISignalQueue.put(('setStatusIcon', 'green'))
         UISignalQueue.put(
             ('updateNetworkStatusTab', (
@@ -170,7 +172,7 @@ class TCPConnection(BMProto, TLSDispatcher):
                     filtered = [
                         (k, v) for k, v in nodes.iteritems()
                         if v["lastseen"] > int(time.time()) -
-                        shared.maximumAgeOfNodesThatIAdvertiseToOthers and
+                        maximumAgeOfNodesThatIAdvertiseToOthers and
                         v["rating"] >= 0 and len(k.host) <= 22
                     ]
                     # sent 250 only if the remote isn't interested in it
diff --git a/src/shared.py b/src/shared.py
index beed52ed..072d04c0 100644
--- a/src/shared.py
+++ b/src/shared.py
@@ -13,7 +13,6 @@ import os
 import stat
 import subprocess
 import sys
-import threading
 from binascii import hexlify
 
 # Project imports.
@@ -27,19 +26,6 @@ from helper_sql import sqlQuery
 from pyelliptic import arithmetic
 
 
-verbose = 1
-# This is obsolete with the change to protocol v3
-# but the singleCleaner thread still hasn't been updated
-# so we need this a little longer.
-maximumAgeOfAnObjectThatIAmWillingToAccept = 216000
-# Equals 4 weeks. You could make this longer if you want
-# but making it shorter would not be advisable because
-# there is a very small possibility that it could keep you
-# from obtaining a needed pubkey for a period of time.
-lengthOfTimeToHoldOnToAllPubkeys = 2419200
-maximumAgeOfNodesThatIAdvertiseToOthers = 10800  # Equals three hours
-
-
 myECCryptorObjects = {}
 MyECSubscriptionCryptorObjects = {}
 # The key in this dictionary is the RIPE hash which is encoded
@@ -48,19 +34,6 @@ myAddressesByHash = {}
 # The key in this dictionary is the tag generated from the address.
 myAddressesByTag = {}
 broadcastSendersForWhichImWatching = {}
-printLock = threading.Lock()
-statusIconColor = 'red'
-
-thisapp = None  # singleton lock instance
-
-ackdataForWhichImWatching = {}
-# used by API command clientStatus
-clientHasReceivedIncomingConnections = False
-numberOfMessagesProcessed = 0
-numberOfBroadcastsProcessed = 0
-numberOfPubkeysProcessed = 0
-
-maximumLengthOfTimeToBotherResendingMessages = 0
 
 
 def isAddressInMyAddressBook(address):
diff --git a/src/shutdown.py b/src/shutdown.py
index dbc2af04..819aa2da 100644
--- a/src/shutdown.py
+++ b/src/shutdown.py
@@ -4,7 +4,6 @@ import Queue
 import threading
 import time
 
-import shared
 import state
 from debug import logger
 from helper_sql import sqlQuery, sqlStoredProcedure
@@ -80,9 +79,9 @@ def doCleanShutdown():
             except Queue.Empty:
                 break
 
-    if shared.thisapp.daemon or not state.enableGUI:  # ..fixme:: redundant?
+    if state.thisapp.daemon or not state.enableGUI:
         logger.info('Clean shutdown complete.')
-        shared.thisapp.cleanup()
+        state.thisapp.cleanup()
         os._exit(0)  # pylint: disable=protected-access
     else:
         logger.info('Core shutdown complete.')
diff --git a/src/state.py b/src/state.py
index 58e1106a..8bfaf7b9 100644
--- a/src/state.py
+++ b/src/state.py
@@ -39,6 +39,8 @@ sqlReady = False
 
 maximumNumberOfHalfOpenConnections = 0
 
+maximumLengthOfTimeToBotherResendingMessages = 0
+
 invThread = None
 addrThread = None
 downloadThread = None
@@ -55,3 +57,21 @@ testmode = False
 kivy = False
 
 association = ''
+
+clientHasReceivedIncomingConnections = False
+"""used by API command clientStatus"""
+
+numberOfMessagesProcessed = 0
+numberOfBroadcastsProcessed = 0
+numberOfPubkeysProcessed = 0
+
+statusIconColor = 'red'
+"""
+GUI status icon color
+.. note:: bad style, refactor it
+"""
+
+ackdataForWhichImWatching = {}
+
+thisapp = None
+"""Singleton instance"""
diff --git a/src/threads.py b/src/threads.py
index b7471508..ac8bf7a6 100644
--- a/src/threads.py
+++ b/src/threads.py
@@ -40,7 +40,9 @@ else:
     threading.Thread._Thread__bootstrap = _thread_name_hack
 
 
+printLock = threading.Lock()
+
 __all__ = [
     "addressGenerator", "objectProcessor", "singleCleaner", "singleWorker",
-    "sqlThread"
+    "sqlThread", "printLock"
 ]