modified:   base_node.py
	modified:   controller.py

	modified:   end-device.py
diff --git a/base_node.py b/base_node.py
index 62a0fcf..76fb854 100644
--- a/base_node.py
+++ b/base_node.py
@@ -116,6 +116,9 @@
         Called before the event loop starts.
         """
         pass
+    
+    def getKeyChain(self):
+        return self._keyChain
 
     def getDefaultCertificateName(self):
         try:
@@ -217,7 +220,3 @@
                     return line.split(':')[1].strip()
 
 
-def main():
-    b = BaseNode()
-
-main()
diff --git a/controller.py b/controller.py
index 753cb4b..484751b 100644
--- a/controller.py
+++ b/controller.py
@@ -23,6 +23,8 @@
 from pyndn import Data
 from pyndn import Face
 from pyndn.security import KeyChain
+from base_node import BaseNode
+
 
 def dump(*list):
     result = ""
@@ -30,10 +32,9 @@
         result += (element if type(element) is str else repr(element)) + " "
     print(result)
 
-class Controller(object):
-    def __init__(self, keyChain, certificateName):
-        self._keyChain = keyChain
-        self._certificateName = certificateName
+class Controller(BaseNode):
+    def __init__(self):
+        super(Controller, self).__init__()
         self._responseCount = 0
 
     def onInterest(self, prefix, interest, transport, registeredPrefixId):
@@ -55,16 +56,18 @@
         self._responseCount += 1
         dump("Register failed for prefix", prefix.toUri())
 
-def main():
+if __name__ == '__main__':
+
     # The default Face will connect using a Unix socket, or to "localhost".
     face = Face()
 
     # Use the system default key chain and certificate name to sign commands.
-    keyChain = KeyChain()
-    face.setCommandSigningInfo(keyChain, keyChain.getDefaultCertificateName())
+    
+    controller = Controller()
+    face.setCommandSigningInfo(controller.getKeyChain(), controller.getDefaultCertificateName())
 
     # Also use the default certificate name to sign data packets.
-    controller = Controller(keyChain, keyChain.getDefaultCertificateName())
+
     prefix = Name("/home/")
     dump("Register prefix", prefix.toUri())
     face.registerPrefix(prefix, controller.onInterest, controller.onRegisterFailed)
@@ -76,4 +79,3 @@
 
     face.shutdown()
 
-main()
diff --git a/end-device.py b/end-device.py
index 9a189be..26c1612 100644
--- a/end-device.py
+++ b/end-device.py
@@ -20,6 +20,7 @@
 import time
 from pyndn import Name
 from pyndn import Face
+from base_node import BaseNode
 
 def dump(*list):
     result = ""
@@ -27,8 +28,11 @@
         result += (element if type(element) is str else repr(element)) + " "
     print(result)
 
-class Device(object):
+class Device(BaseNode):
     def __init__(self):
+        super(Device, self).__init__()
+        
+        self.deviceSerial = self.getSerial()
         self._callbackCount = 0
 
     def onData(self, interest, data):
@@ -41,7 +45,7 @@
         self._callbackCount += 1
         dump("Time out for interest", interest.getName().toUri())
 
-def main():
+if __name__ == '__main__':
     face = Face("")
 
     device = Device()
@@ -58,4 +62,3 @@
 
     face.shutdown()
 
-main()