diff --git a/controller.py b/controller.py
new file mode 100644
index 0000000..9eee1ae
--- /dev/null
+++ b/controller.py
@@ -0,0 +1,78 @@
+# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2014-2015 Regents of the University of California.
+# Author: Jeff Thompson <jefft0@remap.ucla.edu>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# A copy of the GNU Lesser General Public License is in the file COPYING.
+
+
+import time
+from pyndn import Name
+from pyndn import Data
+from pyndn import Face
+from pyndn.security import KeyChain
+
+def dump(*list):
+    result = ""
+    for element in list:
+        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
+        self._responseCount = 0
+
+    def onInterest(self, prefix, interest, transport, registeredPrefixId):
+        self._responseCount += 1
+
+        dump("interest ": interest)
+        # Make and sign a Data packet.
+        #data = Data(interest.getName())
+        #content = "Echo " + interest.getName().toUri()
+        #data.setContent(content)
+        #self._keyChain.sign(data, self._certificateName)
+        #encodedData = data.wireEncode()
+
+        #dump("Sent content", content)
+        #transport.send(encodedData.toBuffer())
+
+    def onRegisterFailed(self, prefix):
+        self._responseCount += 1
+        dump("Register failed for prefix", prefix.toUri())
+
+def 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())
+
+    # 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)
+
+    while controller._responseCount < 100:
+        face.processEvents()
+        # We need to sleep for a few milliseconds so we don't use 100% of the CPU.
+        time.sleep(0.01)
+
+    face.shutdown()
+
+main()
\ No newline at end of file
diff --git a/end-device.py b/end-device.py
new file mode 100644
index 0000000..a66447d
--- /dev/null
+++ b/end-device.py
@@ -0,0 +1,61 @@
+# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2014-2015 Regents of the University of California.
+# Author: Jeff Thompson <jefft0@remap.ucla.edu>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# A copy of the GNU Lesser General Public License is in the file COPYING.
+
+import time
+from pyndn import Name
+from pyndn import Face
+
+def dump(*list):
+    result = ""
+    for element in list:
+        result += (element if type(element) is str else repr(element)) + " "
+    print(result)
+
+class Device(object):
+    def __init__(self):
+        self._callbackCount = 0
+
+    def onData(self, interest, data):
+        self._callbackCount += 1
+        dump("Got data packet with name", data.getName().toUri())
+        # Use join to convert each byte to chr.
+        dump(data.getContent().toRawStr())
+
+    def onTimeout(self, interest):
+        self._callbackCount += 1
+        dump("Time out for interest", interest.getName().toUri())
+
+def main():
+    face = Face("")
+
+    device = Device()
+
+    name1 = Name("/home/controller/bootstrap/publickey/category1/id")
+    dump("Express name ", name1.toUri())
+    face.expressInterest(name1, device.onData, device.onTimeout)
+
+
+    while counter._callbackCount < 10:
+        face.processEvents()
+        # We need to sleep for a few milliseconds so we don't use 100% of the CPU.
+        time.sleep(0.01)
+
+    face.shutdown()
+
+main()
\ No newline at end of file
