diff --git a/app/src/main/java/com/intel/jndn/management/EncodingHelper.java b/app/src/main/java/com/intel/jndn/management/EncodingHelper.java
deleted file mode 100644
index 5d658ee..0000000
--- a/app/src/main/java/com/intel/jndn/management/EncodingHelper.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management;
-
-import java.nio.ByteBuffer;
-import net.named_data.jndn.ControlParameters;
-import net.named_data.jndn.ForwardingFlags;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.Tlv;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Provide helper methods to cover areas too protected in Tlv0_1_1WireFormat;
- * this class can be deprecated if WireFormats allow passing in an existing
- * TlvEncoder/TlvDecoder (currently these methods are protected).
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class EncodingHelper {
-
-  /**
-   * Helper to decode names since Tlv0_1_1WireFormat.java uses its own internal,
-   * protected implementation.
-   *
-   * @param input
-   * @return
-   * @throws EncodingException
-   */
-  public static Name decodeName(ByteBuffer input) throws EncodingException {
-    TlvDecoder decoder = new TlvDecoder(input);
-    return decodeName(decoder);
-  }
-
-  /**
-   * Helper to decode names using an existing decoding context; could be merged
-   * to Tlv0_1_1WireFormat.java.
-   *
-   * @param decoder
-   * @return
-   * @throws EncodingException
-   */
-  public static Name decodeName(TlvDecoder decoder) throws EncodingException {
-    Name name = new Name();
-    int endOffset = decoder.readNestedTlvsStart(Tlv.Name);
-    while (decoder.getOffset() < endOffset) {
-      name.append(new Blob(decoder.readBlobTlv(Tlv.NameComponent), true));
-    }
-
-    decoder.finishNestedTlvs(endOffset);
-    return name;
-  }
-
-  /**
-   * Helper to encode names since Tlv0_1_1WireFormat.java uses its own internal,
-   * protected implementation.
-   *
-   * @param name
-   * @return
-   */
-  public static Blob encodeName(Name name) {
-    TlvEncoder encoder = new TlvEncoder();
-    encodeName(name, encoder);
-    return new Blob(encoder.getOutput(), false);
-  }
-
-  /**
-   * Helper to encode names using an existing encoding context; could be merged
-   * to Tlv0_1_1WireFormat.java.
-   *
-   * @param name
-   * @param encoder
-   */
-  public static final void encodeName(Name name, TlvEncoder encoder) {
-    int saveLength = encoder.getLength();
-    for (int i = name.size() - 1; i >= 0; --i) {
-      encoder.writeBlobTlv(Tlv.NameComponent, name.get(i).getValue().buf());
-    }
-    encoder.writeTypeAndLength(Tlv.Name, encoder.getLength() - saveLength);
-  }
-
-  /**
-   * Helper to encode control parameters using an existing encoding context;
-   * could be merged to Tlv0_1_1WireFormat.java.
-   *
-   * @param controlParameters
-   * @param encoder
-   */
-  public static final void encodeControlParameters(ControlParameters controlParameters, TlvEncoder encoder) {
-    int saveLength = encoder.getLength();
-
-    // Encode backwards.
-    encoder.writeOptionalNonNegativeIntegerTlvFromDouble(Tlv.ControlParameters_ExpirationPeriod,
-            controlParameters.getExpirationPeriod());
-
-    // Encode strategy
-    if (controlParameters.getStrategy().size() != 0) {
-      int strategySaveLength = encoder.getLength();
-      encodeName(controlParameters.getStrategy(), encoder);
-      encoder.writeTypeAndLength(Tlv.ControlParameters_Strategy,
-              encoder.getLength() - strategySaveLength);
-    }
-
-    // Encode ForwardingFlags
-    int flags = controlParameters.getForwardingFlags().getNfdForwardingFlags();
-    if (flags != new ForwardingFlags().getNfdForwardingFlags()) // The flags are not the default value.
-    {
-      encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Flags, flags);
-    }
-
-    encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_Cost, controlParameters.getCost());
-    encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_Origin, controlParameters.getOrigin());
-    encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_LocalControlFeature,
-            controlParameters.getLocalControlFeature());
-
-    // Encode URI
-    if (!controlParameters.getUri().isEmpty()) {
-      encoder.writeBlobTlv(Tlv.ControlParameters_Uri,
-              new Blob(controlParameters.getUri()).buf());
-    }
-
-    encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId, controlParameters.getFaceId());
-
-    // Encode name
-    if (controlParameters.getName().size() != 0) {
-      encodeName(controlParameters.getName(), encoder);
-    }
-
-    encoder.writeTypeAndLength(Tlv.ControlParameters_ControlParameters, encoder.getLength() - saveLength);
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/management/ManagementException.java b/app/src/main/java/com/intel/jndn/management/ManagementException.java
deleted file mode 100644
index 70a15d1..0000000
--- a/app/src/main/java/com/intel/jndn/management/ManagementException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.ControlResponse;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a failure to correctly manage the NDN Forwarding Daemon (NFD).
- * Inspect this object with getCause() to see why the management operation
- * failed.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class ManagementException extends Exception {
-
-  /**
-   *
-   * @param message
-   */
-  public ManagementException(String message) {
-    super(message);
-  }
-
-  /**
-   *
-   * @param message
-   * @param cause
-   */
-  public ManagementException(String message, Throwable cause) {
-    super(message, cause);
-  }
-
-  /**
-   * Parse an NFD response to create a ManagementException.
-   *
-   * @param forwarderResponse
-   * @return
-   */
-  public static ManagementException fromResponse(Blob forwarderResponse) {
-    ControlResponse response = new ControlResponse();
-    try {
-      response.wireDecode(forwarderResponse.buf());
-      String message = "Action failed, forwarder returned: " + response.getStatusCode() + " " + response.getStatusText();
-      return new ManagementException(message);
-    } catch (EncodingException e) {
-      return new ManagementException("Action failed and forwarder response was unparseable.", e);
-    }
-  }
-
-  /**
-   * Parse an NFD response to create a ManagementException.
-   *
-   * @param forwarderResponse
-   * @return
-   */
-  public static ManagementException fromResponse(ControlResponse response) {
-    String message = "Action failed, forwarder returned: " + response.getStatusCode() + " " + response.getStatusText();
-    return new ManagementException(message);
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/management/NFD.java b/app/src/main/java/com/intel/jndn/management/NFD.java
deleted file mode 100644
index b62cbe6..0000000
--- a/app/src/main/java/com/intel/jndn/management/NFD.java
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.StatusDataset;
-import com.intel.jndn.management.types.ControlResponse;
-import com.intel.jndn.management.types.FaceStatus;
-import com.intel.jndn.management.types.FibEntry;
-import com.intel.jndn.management.types.ForwarderStatus;
-import com.intel.jndn.management.types.LocalControlHeader;
-import com.intel.jndn.management.types.RibEntry;
-import com.intel.jndn.utils.SimpleClient;
-import com.intel.jndn.utils.SegmentedClient;
-import java.io.IOException;
-import java.util.List;
-import net.named_data.jndn.ControlParameters;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.ForwardingFlags;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.security.SecurityException;
-import java.util.logging.Logger;
-
-import net.named_data.nfd.utils.G;
-
-/**
- * Helper class for interacting with an NDN forwarder daemon; see
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/Management">http://redmine.named-data.net/projects/nfd/wiki/Management</a>
- * for explanations of the various protocols used.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class NFD {
-
-  public final static long DEFAULT_TIMEOUT = 2000;
-  public final static int OK_STATUS = 200;
-  static private final Logger logger = Logger.getLogger(NFD.class.getName());
-
-  /**
-   * Ping a forwarder on an existing face to verify that the forwarder is
-   * working and responding to requests; this version sends a discovery packet
-   * to /localhost/nfd which should always respond if the requestor is on the
-   * same machine as the NDN forwarding daemon.
-   *
-   * @param face only a localhost Face
-   * @return true if successful, false otherwise
-   */
-  public static boolean pingLocal(Face face) {
-    return ping(face, new Name("/localhost/nfd"));
-  }
-
-  /**
-   * Request a name on an existing face to verify the forwarder is working and
-   * responding to requests. Note that the name must be served or cached on the
-   * forwarder for this to return true.
-   *
-   * @param face
-   * @param name
-   * @return true if successful, false otherwise
-   */
-  public static boolean ping(Face face, Name name) {
-    // build interest
-    Interest interest = new Interest(name);
-    interest.setInterestLifetimeMilliseconds(DEFAULT_TIMEOUT);
-    interest.setMustBeFresh(true);
-
-    // send packet
-    try {
-      Data data = SimpleClient.getDefault().getSync(face, interest);
-      return data != null;
-    } catch (IOException e) {
-      return false;
-    }
-  }
-
-  /**
-   * Retrieve the status of the given forwarder; calls /localhost/nfd/status
-   * which requires a local Face (all non-local packets are dropped)
-   *
-   * @param forwarder only a localhost Face
-   * @return the forwarder status object, see
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus">
-   * http://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus</a>.
-   * @throws java.lang.Exception
-   */
-  public static ForwarderStatus getForwarderStatus(Face forwarder) throws Exception {
-    Interest interest = new Interest(new Name("/localhost/nfd/status"));
-    interest.setMustBeFresh(true);
-    interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
-    interest.setInterestLifetimeMilliseconds(DEFAULT_TIMEOUT);
-
-    Data data = SimpleClient.getDefault().getSync(forwarder, interest);
-    G.Log("-----------" + data.getName().toUri());
-    ForwarderStatus status = new ForwarderStatus();
-    status.wireDecode(data.getContent().buf());
-    G.Log("----------- done");
-    return status;
-  }
-
-  /**
-   * Retrieve a list of faces and their status from the given forwarder; calls
-   * /localhost/nfd/faces/list which requires a local Face (all non-local
-   * packets are dropped)
-   *
-   * @param forwarder only a localhost Face
-   * @return a list of face status objects, see
-   * http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt.
-   * @throws java.lang.Exception
-   */
-  public static List<FaceStatus> getFaceList(Face forwarder) throws Exception {
-    Data data = retrieveDataSet(forwarder, new Name("/localhost/nfd/faces/list"));
-    return StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
-  }
-
-  /**
-   * Retrieve a list of FIB entries and their NextHopRecords from the given
-   * forwarder; calls /localhost/nfd/fib/list which requires a local Face (all
-   * non-local packets are dropped).
-   *
-   * @param forwarder only a localhost Face
-   * @return a list of FIB entries, see
-   * http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset.
-   * @throws java.lang.Exception
-   */
-  public static List<FibEntry> getFibList(Face forwarder) throws Exception {
-    Data data = retrieveDataSet(forwarder, new Name("/localhost/nfd/fib/list"));
-    return StatusDataset.wireDecode(data.getContent(), FibEntry.class);
-  }
-
-  /**
-   * Retrieve a list of routing entries from the RIB; calls
-   * /localhost/nfd/rib/list which requires a local Face (all non-local packets
-   * are dropped).
-   *
-   * @param forwarder only a localhost Face
-   * @return a list of RIB entries, i.e. routes, see
-   * http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#RIB-Dataset.
-   * @throws java.lang.Exception
-   */
-  public static List<RibEntry> getRouteList(Face forwarder) throws Exception {
-    Data data = retrieveDataSet(forwarder, new Name("/localhost/nfd/rib/list"));
-    return StatusDataset.wireDecode(data.getContent(), RibEntry.class);
-  }
-
-  /**
-   * Helper method to register a new face on the forwarder; as mentioned at
-   * <a href="http://named-data.net/doc/NFD/current/manpages/nfdc.html">http://named-data.net/doc/NFD/current/manpages/nfdc.html</a>,
-   * this is more for debugging; use 'register' instead
-   *
-   * @param forwarder only a localhost Face
-   * @param faceId
-   * @param prefix
-   * @throws java.lang.Exception
-   */
-  public static void addNextHop(Face forwarder, int faceId, Name prefix) throws Exception {
-    // build command name
-    Name command = new Name("/localhost/nfd/fib/add-nexthop");
-    ControlParameters parameters = new ControlParameters();
-    parameters.setName(prefix);
-    parameters.setFaceId(faceId);
-    command.append(parameters.wireEncode());
-
-    // send the interest
-    sendCommand(forwarder, new Interest(command));
-  }
-
-  /**
-   * Create a new face on the given forwarder. Ensure the forwarding face is on
-   * the local machine (management requests are to /localhost/...) and that
-   * command signing has been set up (e.g. forwarder.setCommandSigningInfo()).
-   *
-   * @param forwarder only a localhost Face
-   * @param uri
-   * @return
-   * @throws java.lang.Exception
-   */
-  public static int createFace(Face forwarder, String uri) throws Exception {
-    Name command = new Name("/localhost/nfd/faces/create");
-    ControlParameters parameters = new ControlParameters();
-    parameters.setUri(uri);
-    command.append(parameters.wireEncode());
-
-    // send the interest
-    ControlResponse response = sendCommand(forwarder, new Interest(command));
-
-    // return
-    return response.getBody().get(0).getFaceId();
-  }
-
-  /**
-   * Destroy a face on given forwarder. Ensure the forwarding face is on the
-   * local machine (management requests are to /localhost/...) and that command
-   * signing has been set up (e.g. forwarder.setCommandSigningInfo()).
-   *
-   * @param forwarder only a localhost Face
-   * @param faceId
-   * @throws java.lang.Exception
-   */
-  public static void destroyFace(Face forwarder, int faceId) throws Exception {
-    Name command = new Name("/localhost/nfd/faces/destroy");
-    ControlParameters parameters = new ControlParameters();
-    parameters.setFaceId(faceId);
-    command.append(parameters.wireEncode());
-
-    // send the interest
-    sendCommand(forwarder, new Interest(command));
-  }
-
-  /**
-   * Enable a local control feature on the given forwarder. See
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Enable-a-LocalControlHeader-feature">http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Enable-a-LocalControlHeader-feature</a>
-   *
-   * @param forwarder
-   * @param header
-   * @throws Exception
-   */
-  public static void enableLocalControlHeader(Face forwarder, LocalControlHeader header) throws Exception {
-    // build command name
-    Name command = new Name("/localhost/nfd/faces/enable-local-control");
-    ControlParameters parameters = new ControlParameters();
-    parameters.setLocalControlFeature(header.getNumericValue());
-    command.append(parameters.wireEncode());
-
-    // send command and return
-    sendCommand(forwarder, new Interest(command));
-  }
-
-  /**
-   * Disable a local control feature on the given forwarder. See
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Disable-a-LocalControlHeader-feature">http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Disable-a-LocalControlHeader-feature</a>
-   *
-   * @param forwarder
-   * @param header
-   * @throws Exception
-   */
-  public static void disableLocalControlHeader(Face forwarder, LocalControlHeader header) throws Exception {
-    // build command name
-    Name command = new Name("/localhost/nfd/faces/disable-local-control");
-    ControlParameters parameters = new ControlParameters();
-    parameters.setLocalControlFeature(header.getNumericValue());
-    command.append(parameters.wireEncode());
-
-    // send command and return
-    sendCommand(forwarder, new Interest(command));
-  }
-
-  /**
-   * Register a route on the forwarder; see
-   * <a href="http://named-data.net/doc/NFD/current/manpages/nfdc.html">http://named-data.net/doc/NFD/current/manpages/nfdc.html</a>
-   * for command-line usage and
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/RibMgmt">http://redmine.named-data.net/projects/nfd/wiki/RibMgmt</a>
-   * for protocol documentation. Ensure the forwarding face is on the local
-   * machine (management requests are to /localhost/...) and that command
-   * signing has been set up (e.g. forwarder.setCommandSigningInfo()).
-   *
-   * @param forwarder only a localhost Face
-   * @param controlParameters
-   * @throws Exception
-   */
-  public static void register(Face forwarder, ControlParameters controlParameters) throws Exception {
-    // build command name
-    Name command = new Name("/localhost/nfd/rib/register");
-    command.append(controlParameters.wireEncode());
-
-    // send the interest
-    sendCommand(forwarder, new Interest(command));
-  }
-
-  /**
-   * Register a route on a forwarder; this will create a new face on the
-   * forwarder to the given URI/route pair. See register(Face,
-   * ControlParameters) for more details documentation.
-   *
-   * @param forwarder only a localhost Face
-   * @param uri
-   * @param cost
-   * @param route
-   * @throws java.lang.Exception
-   */
-  public static void register(Face forwarder, String uri, Name route, int cost) throws Exception {
-    // create the new face
-    int faceId = createFace(forwarder, uri);
-
-    // run base method
-    register(forwarder, faceId, route, cost);
-  }
-
-  /**
-   * Register a route on a forwarder; this will not create a new face since it
-   * is provided a faceId. See register(Face, ControlParameters) for full
-   * documentation
-   *
-   * @param forwarder only a localhost Face
-   * @param faceId
-   * @param route
-   * @param cost
-   * @throws java.lang.Exception
-   */
-  public static void register(Face forwarder, int faceId, Name route, int cost) throws Exception {
-    // build command name
-    ControlParameters parameters = new ControlParameters();
-    parameters.setName(route);
-    parameters.setFaceId(faceId);
-    parameters.setCost(cost);
-    ForwardingFlags flags = new ForwardingFlags();
-    flags.setCapture(true);
-    flags.setChildInherit(true);
-    parameters.setForwardingFlags(flags);
-
-    // run base method
-    register(forwarder, parameters);
-  }
-
-  /**
-   * Unregister a route on a forwarder; see
-   * <a href="http://named-data.net/doc/NFD/current/manpages/nfdc.html">http://named-data.net/doc/NFD/current/manpages/nfdc.html</a>
-   * for command-line usage and
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/RibMgmt">http://redmine.named-data.net/projects/nfd/wiki/RibMgmt</a>
-   * for protocol documentation. Ensure the forwarding face is on the local
-   * machine (management requests are to /localhost/...) and that command
-   * signing has been set up (e.g. forwarder.setCommandSigningInfo()
-   *
-   * @param forwarder
-   * @param controlParameters
-   * @throws java.lang.Exception
-   */
-  public static void unregister(Face forwarder, ControlParameters controlParameters) throws Exception {
-    // build command name
-    Name command = new Name("/localhost/nfd/rib/unregister");
-    command.append(controlParameters.wireEncode());
-
-    // send the interest
-    sendCommand(forwarder, new Interest(command));
-  }
-
-  /**
-   * Unregister a route on a forwarder; see
-   * <a href="http://named-data.net/doc/NFD/current/manpages/nfdc.html">http://named-data.net/doc/NFD/current/manpages/nfdc.html</a>
-   * for command-line usage and
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/RibMgmt">http://redmine.named-data.net/projects/nfd/wiki/RibMgmt</a>
-   * for protocol documentation. Ensure the forwarding face is on the local
-   * machine (management requests are to /localhost/...) and that command
-   * signing has been set up (e.g. forwarder.setCommandSigningInfo()
-   *
-   * @param forwarder
-   * @param route
-   * @throws java.lang.Exception
-   */
-  public static void unregister(Face forwarder, Name route) throws Exception {
-    // build command name
-    ControlParameters controlParameters = new ControlParameters();
-    controlParameters.setName(route);
-
-    // send the interest
-    unregister(forwarder, controlParameters);
-  }
-
-  /**
-   * Unregister a route on a forwarder; see
-   * <a href="http://named-data.net/doc/NFD/current/manpages/nfdc.html">http://named-data.net/doc/NFD/current/manpages/nfdc.html</a>
-   * for command-line usage and
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/RibMgmt">http://redmine.named-data.net/projects/nfd/wiki/RibMgmt</a>
-   * for protocol documentation. Ensure the forwarding face is on the local
-   * machine (management requests are to /localhost/...) and that command
-   * signing has been set up (e.g. forwarder.setCommandSigningInfo()
-   *
-   * @param forwarder
-   * @param route
-   * @param faceId
-   * @throws java.lang.Exception
-   */
-  public static void unregister(Face forwarder, Name route, int faceId) throws Exception {
-    // build command name
-    ControlParameters controlParameters = new ControlParameters();
-    controlParameters.setName(route);
-    controlParameters.setFaceId(faceId);
-
-    // send the interest
-    unregister(forwarder, controlParameters);
-  }
-
-  /**
-   * Unregister a route on a forwarder; see
-   * <a href="http://named-data.net/doc/NFD/current/manpages/nfdc.html">http://named-data.net/doc/NFD/current/manpages/nfdc.html</a>
-   * for command-line usage and
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/RibMgmt">http://redmine.named-data.net/projects/nfd/wiki/RibMgmt</a>
-   * for protocol documentation. Ensure the forwarding face is on the local
-   * machine (management requests are to /localhost/...) and that command
-   * signing has been set up (e.g. forwarder.setCommandSigningInfo()
-   *
-   * @param forwarder
-   * @param route
-   * @param uri
-   * @throws java.lang.Exception
-   */
-  public static void unregister(Face forwarder, Name route, String uri) throws Exception {
-    int faceId = -1;
-    for (FaceStatus face : getFaceList(forwarder)) {
-      if (face.getUri().matches(uri)) {
-        faceId = face.getFaceId();
-        break;
-      }
-    }
-
-    if (faceId == -1) {
-      throw new ManagementException("Face not found: " + uri);
-    }
-
-    // send the interest
-    unregister(forwarder, route, faceId);
-  }
-
-  /**
-   * Set a strategy on the forwarder; see
-   * <a href="http://named-data.net/doc/NFD/current/manpages/nfdc.html">http://named-data.net/doc/NFD/current/manpages/nfdc.html</a>
-   * for command-line usage and
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice">http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice</a>
-   * for protocol documentation. Ensure the forwarding face is on the local
-   * machine (management requests are to /localhost/...) and that command
-   * signing has been set up (e.g. forwarder.setCommandSigningInfo()).
-   *
-   * @param forwarder only a localhost Face
-   * @param prefix
-   * @param strategy
-   * @throws Exception
-   */
-  public static void setStrategy(Face forwarder, Name prefix, Name strategy) throws Exception {
-    // build command name
-    Name command = new Name("/localhost/nfd/strategy-choice/set");
-    ControlParameters parameters = new ControlParameters();
-    parameters.setName(prefix);
-    parameters.setStrategy(strategy);
-    command.append(parameters.wireEncode());
-
-    // send the interest
-    sendCommand(forwarder, new Interest(command));
-  }
-
-  /**
-   * Build an interest to retrieve a segmented data set from the NFD; for
-   * details on the DataSet, see
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/StatusDataset">http://redmine.named-data.net/projects/nfd/wiki/StatusDataset</a>
-   *
-   * @param forwarder
-   * @param datasetName
-   * @return
-   * @throws IOException
-   * @throws ManagementException
-   */
-  public static Data retrieveDataSet(Face forwarder, Name datasetName) throws IOException, ManagementException {
-    // build management Interest packet; see <a href="http://redmine.named-data.net/projects/nfd/wiki/StatusDataset">http://redmine.named-data.net/projects/nfd/wiki/StatusDataset</a>
-    Interest interest = new Interest(datasetName);
-    interest.setMustBeFresh(true);
-    interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
-    interest.setInterestLifetimeMilliseconds(DEFAULT_TIMEOUT);
-
-    // send packet
-    Data data = SegmentedClient.getDefault().getSync(forwarder, interest);
-
-    // check for failed request
-    if (data.getContent().buf().get(0) == ControlResponse.TLV_CONTROL_RESPONSE) {
-      throw ManagementException.fromResponse(data.getContent());
-    }
-
-    return data;
-  }
-
-  /**
-   * Send an interest as a command to the forwarder; this method will convert
-   * the interest to a command interest and block until a response is received
-   * from the forwarder. Ensure the forwarding face is on the local machine
-   * (management requests are to /localhost/...) and that command signing has
-   * been set up (e.g. forwarder.setCommandSigningInfo()).
-   *
-   * @param forwarder only a localhost Face, command signing info must be set
-   * @param interest As described at
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/ControlCommand,">http://redmine.named-data.net/projects/nfd/wiki/ControlCommand,</a>
-   * the requested interest must have encoded ControlParameters appended to the
-   * interest name
-   * @return
-   * @throws java.io.IOException
-   * @throws net.named_data.jndn.encoding.EncodingException
-   * @throws com.intel.jndn.management.ManagementException
-   */
-  public static ControlResponse sendCommand(Face forwarder, Interest interest) throws IOException, EncodingException, ManagementException {
-    // forwarder must have command signing info set
-    try {
-      forwarder.makeCommandInterest(interest);
-    } catch (SecurityException e) {
-      throw new IllegalArgumentException("Failed to make command interest; ensure command signing info is set on the face.", e);
-    }
-
-    // send command packet
-    Data data = SimpleClient.getDefault().getSync(forwarder, interest);
-
-    // decode response
-    ControlResponse response = new ControlResponse();
-    response.wireDecode(data.getContent().buf());
-
-    // check response for success
-    if (response.getStatusCode() != OK_STATUS) {
-      throw ManagementException.fromResponse(response);
-    }
-
-    return response;
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/ControlResponse.java b/app/src/main/java/com/intel/jndn/management/types/ControlResponse.java
deleted file mode 100644
index 5514244..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/ControlResponse.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-import com.intel.jndn.management.EncodingHelper;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.ControlParameters;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.Tlv;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a ControlResponse, a Data packet sent in response to a
- * ControlCommand to the NFD, see
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/ControlCommand">http://redmine.named-data.net/projects/nfd/wiki/ControlCommand</a>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class ControlResponse {
-
-  /**
-   * Use TLV codes from jndn.encoding.tlv.Tlv.java See
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/ControlCommand">http://redmine.named-data.net/projects/nfd/wiki/ControlCommand</a>
-   */
-  public final static int TLV_CONTROL_RESPONSE = 101;
-  public final static int TLV_CONTROL_RESPONSE_STATUS_CODE = 102;
-  public final static int TLV_CONTROL_RESPONSE_STATUS_TEXT = 103;
-
-  /**
-   * Encode using a new TLV encoder.
-   *
-   * @return The encoded buffer.
-   */
-  public final Blob wireEncode() {
-    TlvEncoder encoder = new TlvEncoder();
-    wireEncode(encoder);
-    return new Blob(encoder.getOutput(), false);
-  }
-
-  /**
-   * Encode as part of an existing encode context.
-   *
-   * @param encoder
-   */
-  public final void wireEncode(TlvEncoder encoder) {
-    int saveLength = encoder.getLength();
-    for (ControlParameters parameters : body) {
-      EncodingHelper.encodeControlParameters(parameters, encoder);
-    }
-    encoder.writeBlobTlv(TLV_CONTROL_RESPONSE_STATUS_TEXT, new Blob(statusText).buf());
-    encoder.writeNonNegativeIntegerTlv(TLV_CONTROL_RESPONSE_STATUS_CODE, statusCode);
-    encoder.writeTypeAndLength(TLV_CONTROL_RESPONSE, encoder.getLength() - saveLength);
-  }
-
-  /**
-   * Decode the input from its TLV format.
-   *
-   * @param input The input buffer to decode. This reads from position() to
-   * limit(), but does not change the position.
-   * @throws net.named_data.jndn.encoding.EncodingException
-   */
-  public final void wireDecode(ByteBuffer input) throws EncodingException {
-    TlvDecoder decoder = new TlvDecoder(input);
-    wireDecode(decoder, input);
-  }
-
-  /**
-   * Decode as part of an existing decode context.
-   *
-   * @param decoder
-   * @param input the WireFormat version that decodes ControlParameters does not
-   * allow passing a TlvDecoder, so we must pass the buffer itself
-   * @throws EncodingException
-   */
-  public void wireDecode(TlvDecoder decoder, ByteBuffer input) throws EncodingException {
-    int endOffset = decoder.readNestedTlvsStart(TLV_CONTROL_RESPONSE);
-
-    // parse known TLVs
-    this.statusCode = (int) decoder.readNonNegativeIntegerTlv(TLV_CONTROL_RESPONSE_STATUS_CODE);
-    Blob statusText_ = new Blob(decoder.readBlobTlv(TLV_CONTROL_RESPONSE_STATUS_TEXT), true); // copy because buffer is immutable
-    this.statusText = statusText_.toString();
-
-    // use the already-written decoder for ControlParameters (but we have to copy the buffer)
-    while (decoder.peekType(Tlv.ControlParameters_ControlParameters, endOffset)) {
-      ByteBuffer copyInput = input.duplicate();
-      copyInput.position(decoder.getOffset());
-      int internalEndOffset = decoder.readNestedTlvsStart(Tlv.ControlParameters_ControlParameters);
-      ControlParameters copyParameters = new ControlParameters();
-      copyParameters.wireDecode(copyInput);
-      this.body.add(copyParameters);
-      decoder.seek(internalEndOffset);
-      decoder.finishNestedTlvs(internalEndOffset);
-    }
-
-    decoder.finishNestedTlvs(endOffset);
-  }
-
-  /**
-   * Get status code
-   *
-   * @return
-   */
-  public int getStatusCode() {
-    return statusCode;
-  }
-
-  /**
-   * Set status code
-   *
-   * @param statusCode
-   */
-  public void setStatusCode(int statusCode) {
-    this.statusCode = statusCode;
-  }
-
-  /**
-   * Get status text
-   *
-   * @return
-   */
-  public String getStatusText() {
-    return statusText;
-  }
-
-  /**
-   * Set status text
-   *
-   * @param statusText
-   */
-  public void setStatusText(String statusText) {
-    this.statusText = statusText;
-  }
-
-  /**
-   * Get body
-   *
-   * @return
-   */
-  public List<ControlParameters> getBody() {
-    return body;
-  }
-
-  /**
-   * Set body
-   *
-   * @param body
-   */
-  public void setBody(List<ControlParameters> body) {
-    this.body = body;
-  }
-
-  private int statusCode = -1;
-  private String statusText = "";
-  private List<ControlParameters> body = new ArrayList<>();
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/Decodable.java b/app/src/main/java/com/intel/jndn/management/types/Decodable.java
deleted file mode 100644
index aec50dd..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/Decodable.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-
-/**
- * Interface used by StatusDataset to decode generic message types; if they are
- * Decodable, then StatusDataset will instantiate and decode them.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface Decodable {
-
-  public void wireDecode(TlvDecoder decoder) throws EncodingException;
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/FacePersistency.java b/app/src/main/java/com/intel/jndn/management/types/FacePersistency.java
deleted file mode 100644
index d294fcb..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/FacePersistency.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-/**
- * Indicate whether the face is persistent; used by FaceStatus. See
- * <a href="http://redmine.named-data.net/projects/nfd/widi/FaceMgmt">http://redmine.named-data.net/projects/nfd/widi/FaceMgmt</a>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public enum FacePersistency {
-
-  PERSISTENT(0),
-  ON_DEMAND(1),
-  PERMANENT(2);
-
-  FacePersistency(int value) {
-    value_ = value;
-  }
-
-  public final int getNumericValue() {
-    return value_;
-  }
-  private final int value_;
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/FaceScope.java b/app/src/main/java/com/intel/jndn/management/types/FaceScope.java
deleted file mode 100644
index bcba855..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/FaceScope.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-/**
- * Indicate whether the face is local for scope control purposes; used by
- * FaceStatus See
- * <a href="http://redmine.named-data.net/projects/nfd/widi/FaceMgmt">http://redmine.named-data.net/projects/nfd/widi/FaceMgmt</a>
- *
- * @author andrew
- */
-public enum FaceScope {
-
-  LOCAL(0),
-  NON_LOCAL(1);
-
-  FaceScope(int value) {
-    value_ = value;
-  }
-
-  public final int getNumericValue() {
-    return value_;
-  }
-  private final int value_;
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/FaceStatus.java b/app/src/main/java/com/intel/jndn/management/types/FaceStatus.java
deleted file mode 100644
index 6a101a0..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/FaceStatus.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-import java.nio.ByteBuffer;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a FaceStatus object from /localhost/nfd/faces/list; see
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt">http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt</a>
- * for details
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class FaceStatus implements Decodable {
-
-  /**
-   * Spec from
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/ControlCommand">http://redmine.named-data.net/projects/nfd/wiki/ControlCommand</a>
-   */
-  public static final int TLV_FACE_ID = 105;
-  public static final int TLV_URI = 114;
-  public static final int TLV_EXPIRATION_PERIOD = 109;
-
-  /**
-   * Spec from
-   * <a href="http://redmine.named-data.net/projects/nfd/widi/FaceMgmt">http://redmine.named-data.net/projects/nfd/widi/FaceMgmt</a>
-   */
-  public static final int TLV_FACE_STATUS = 128;
-  public static final int TLV_LOCAL_URI = 129;
-  public static final int TLV_CHANNEL_STATUS = 130;
-  public static final int TLV_FACE_SCOPE = 132;
-  public static final int TLV_FACE_PERSISTENCY = 133;
-  public static final int TLV_LINK_TYPE = 134;
-  public static final int TLV_N_IN_INTERESTS = 144;
-  public static final int TLV_N_IN_DATAS = 145;
-  public static final int TLV_N_OUT_INTERESTS = 146;
-  public static final int TLV_N_OUT_DATAS = 147;
-  public static final int TLV_N_IN_BYTES = 148;
-  public static final int TLV_N_OUT_BYTES = 149;
-  public static final int TLV_NUM_IN_NACKS = 151;
-  public static final int TLV_NUM_OUT_NACKS = 152;
-
-  /**
-   * Encode using a new TLV encoder.
-   *
-   * @return The encoded buffer.
-   */
-  public final Blob wireEncode() {
-    TlvEncoder encoder = new TlvEncoder();
-    wireEncode(encoder);
-    return new Blob(encoder.getOutput(), false);
-  }
-
-  /**
-   * Encode as part of an existing encode context.
-   *
-   * @param encoder
-   */
-  public final void wireEncode(TlvEncoder encoder) {
-    int saveLength = encoder.getLength();
-    encoder.writeNonNegativeIntegerTlv(TLV_N_OUT_BYTES, outBytes);
-    encoder.writeNonNegativeIntegerTlv(TLV_N_IN_BYTES, inBytes);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_OUT_NACKS, numOutNacks);
-    encoder.writeNonNegativeIntegerTlv(TLV_N_OUT_DATAS, outDatas);
-    encoder.writeNonNegativeIntegerTlv(TLV_N_OUT_INTERESTS, outInterests);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_IN_NACKS, numInNacks);
-    encoder.writeNonNegativeIntegerTlv(TLV_N_IN_DATAS, inDatas);
-    encoder.writeNonNegativeIntegerTlv(TLV_N_IN_INTERESTS, inInterests);
-    encoder.writeNonNegativeIntegerTlv(TLV_LINK_TYPE, linkType.getNumericValue());
-    encoder.writeNonNegativeIntegerTlv(TLV_FACE_PERSISTENCY, facePersistency.getNumericValue());
-    encoder.writeNonNegativeIntegerTlv(TLV_FACE_SCOPE, faceScope.getNumericValue());
-    encoder.writeOptionalNonNegativeIntegerTlv(TLV_EXPIRATION_PERIOD, expirationPeriod);
-    encoder.writeBlobTlv(TLV_LOCAL_URI, new Blob(localUri).buf());
-    encoder.writeBlobTlv(TLV_URI, new Blob(uri).buf());
-    encoder.writeNonNegativeIntegerTlv(TLV_FACE_ID, faceId);
-    encoder.writeTypeAndLength(TLV_FACE_STATUS, encoder.getLength() - saveLength);
-  }
-
-  /**
-   * Decode the input from its TLV format.
-   *
-   * @param input The input buffer to decode. This reads from position() to
-   * limit(), but does not change the position.
-   * @throws net.named_data.jndn.encoding.EncodingException
-   */
-  public final void wireDecode(ByteBuffer input) throws EncodingException {
-    TlvDecoder decoder = new TlvDecoder(input);
-    wireDecode(decoder);
-  }
-
-  /**
-   * Decode as part of an existing decode context.
-   *
-   * @param decoder
-   * @throws EncodingException
-   */
-  @Override
-  public void wireDecode(TlvDecoder decoder) throws EncodingException {
-    int endOffset = decoder.readNestedTlvsStart(TLV_FACE_STATUS);
-    // parse
-    this.faceId = (int) decoder.readNonNegativeIntegerTlv(TLV_FACE_ID);
-    Blob uri_ = new Blob(decoder.readBlobTlv(TLV_URI), true); // copy because buffer is immutable
-    this.uri = uri_.toString();
-    Blob localUri_ = new Blob(decoder.readBlobTlv(TLV_LOCAL_URI), true); // copy because buffer is immutable
-    this.localUri = localUri_.toString();
-    this.expirationPeriod = (int) decoder.readOptionalNonNegativeIntegerTlv(TLV_EXPIRATION_PERIOD, endOffset);
-    this.faceScope = FaceScope.values()[(int) decoder.readNonNegativeIntegerTlv(TLV_FACE_SCOPE)];
-    this.facePersistency = FacePersistency.values()[(int) decoder.readNonNegativeIntegerTlv(TLV_FACE_PERSISTENCY)];
-    this.linkType = LinkType.values()[(int) decoder.readNonNegativeIntegerTlv(TLV_LINK_TYPE)];
-    this.inInterests = (int) decoder.readNonNegativeIntegerTlv(TLV_N_IN_INTERESTS);
-    this.inDatas = (int) decoder.readNonNegativeIntegerTlv(TLV_N_IN_DATAS);
-    this.numInNacks = decoder.readNonNegativeIntegerTlv(TLV_NUM_IN_NACKS);
-    this.outInterests = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_INTERESTS);
-    this.outDatas = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_DATAS);
-    this.numOutNacks = decoder.readNonNegativeIntegerTlv(TLV_NUM_OUT_NACKS);
-    this.inBytes = (int) decoder.readNonNegativeIntegerTlv(TLV_N_IN_BYTES);
-    this.outBytes = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_BYTES);
-    decoder.finishNestedTlvs(endOffset);
-  }
-
-  /**
-   * Get face ID
-   *
-   * @return
-   */
-  public int getFaceId() {
-    return faceId;
-  }
-
-  /**
-   * Set face ID
-   *
-   * @param faceId
-   */
-  public void setFaceId(int faceId) {
-    this.faceId = faceId;
-  }
-
-  /**
-   * Get face ID
-   *
-   * @return
-   */
-  public String getUri() {
-    return uri;
-  }
-
-  /**
-   * Set URI
-   *
-   * @param uri
-   */
-  public void setUri(String uri) {
-    this.uri = uri;
-  }
-
-  /**
-   * Get face ID
-   *
-   * @return
-   */
-  public String getLocalUri() {
-    return localUri;
-  }
-
-  /**
-   * Set local URI
-   *
-   * @param localUri
-   */
-  public void setLocalUri(String localUri) {
-    this.localUri = localUri;
-  }
-
-  /**
-   * Get expiration period
-   *
-   * @return
-   */
-  public int getExpirationPeriod() {
-    return expirationPeriod;
-  }
-
-  /**
-   * Set expiration period
-   *
-   * @param expirationPeriod
-   */
-  public void setExpirationPeriod(int expirationPeriod) {
-    this.expirationPeriod = expirationPeriod;
-  }
-
-  /**
-   * Get face scope value
-   *
-   * @return
-   */
-  public FaceScope getFaceScope() {
-    return faceScope;
-  }
-
-  /**
-   * Set face scope value
-   *
-   * @param faceScope
-   */
-  public void setFaceScope(FaceScope faceScope) {
-    this.faceScope = faceScope;
-  }
-
-  /**
-   * Get face persistency value
-   *
-   * @return
-   */
-  public FacePersistency getFacePersistency() {
-    return facePersistency;
-  }
-
-  /**
-   * Set face persistency value
-   *
-   * @param facePersistency
-   */
-  public void setFacePersistency(FacePersistency facePersistency) {
-    this.facePersistency = facePersistency;
-  }
-
-  /**
-   * Get link type
-   *
-   * @return
-   */
-  public LinkType getLinkType() {
-    return linkType;
-  }
-
-  /**
-   * Set link type
-   *
-   * @param linkType
-   */
-  public void setLinkType(LinkType linkType) {
-    this.linkType = linkType;
-  }
-
-  /**
-   * Get number of received Interest packets
-   *
-   * @return
-   */
-  public int getInInterests() {
-    return inInterests;
-  }
-
-  /**
-   * Set number of received Interest packets
-   *
-   * @param inInterests
-   */
-  public void setInInterests(int inInterests) {
-    this.inInterests = inInterests;
-  }
-
-  /**
-   * Get number of sent Interest packets
-   *
-   * @return
-   */
-  public int getOutInterests() {
-    return outInterests;
-  }
-
-  /**
-   * Set number of sent Interest packets
-   *
-   * @param outInterests
-   */
-  public void setOutInterests(int outInterests) {
-    this.outInterests = outInterests;
-  }
-
-  /**
-   * Get number of received Data packets
-   *
-   * @return
-   */
-  public int getInDatas() {
-    return inDatas;
-  }
-
-  /**
-   * Set number of received Data packets
-   *
-   * @param inDatas
-   */
-  public void setInDatas(int inDatas) {
-    this.inDatas = inDatas;
-  }
-
-  /**
-   * Get number of sent Data packets
-   *
-   * @return
-   */
-  public int getOutDatas() {
-    return outDatas;
-  }
-
-  /**
-   * Set number of sent Data packets
-   *
-   * @param outDatas
-   */
-  public void setOutDatas(int outDatas) {
-    this.outDatas = outDatas;
-  }
-
-  /**
-   * Get number of input bytes
-   *
-   * @return
-   */
-  public int getInBytes() {
-    return inBytes;
-  }
-
-  /**
-   * Set number of input bytes
-   *
-   * @param inBytes
-   */
-  public void setInBytes(int inBytes) {
-    this.inBytes = inBytes;
-  }
-
-  /**
-   * Get number of output bytes
-   *
-   * @return
-   */
-  public int getOutBytes() {
-    return outBytes;
-  }
-
-  /**
-   * Set number of output bytes
-   *
-   * @param outBytes
-   */
-  public void setOutBytes(int outBytes) {
-    this.outBytes = outBytes;
-  }
-
-  public long getNumInNacks() {
-    return numInNacks;
-  }
-
-  public void setNumInNacks(long numInNacks) {
-    this.numInNacks = numInNacks;
-  }
-
-  public long getNumOutNacks() {
-    return numOutNacks;
-  }
-
-  public void setNumOutNacks(long numOutNacks) {
-    this.numOutNacks = numOutNacks;
-  }
-
-  private int faceId = -1;
-  private String uri = ""; // can't use URI because some are invalid syntax
-  private String localUri = ""; // can't use URI because some are invalid syntax
-  private int expirationPeriod = 0;
-  private FaceScope faceScope = FaceScope.LOCAL;
-  private FacePersistency facePersistency = FacePersistency.ON_DEMAND;
-  private LinkType linkType = LinkType.POINT_TO_POINT;
-  private int inInterests = 0;
-  private int outInterests = 0;
-  private int inDatas = 0;
-  private int outDatas = 0;
-  private int inBytes = 0;
-  private int outBytes = 0;
-  private long numInNacks = 0;
-  private long numOutNacks = 0;
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/FibEntry.java b/app/src/main/java/com/intel/jndn/management/types/FibEntry.java
deleted file mode 100644
index 8c74636..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/FibEntry.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-import com.intel.jndn.management.EncodingHelper;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a FibEntry returned from /localhost/nfd/fib/list; see
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset">http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset</a>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class FibEntry implements Decodable {
-
-  public final static int TLV_FIB_ENTRY = 128;
-
-  /**
-   * Encode using a new TLV encoder.
-   *
-   * @return The encoded buffer.
-   */
-  public final Blob wireEncode() {
-    TlvEncoder encoder = new TlvEncoder();
-    wireEncode(encoder);
-    return new Blob(encoder.getOutput(), false);
-  }
-
-  /**
-   * Encode as part of an existing encode context.
-   *
-   * @param encoder
-   */
-  public final void wireEncode(TlvEncoder encoder) {
-    int saveLength = encoder.getLength();
-    for (NextHopRecord record : records) {
-      record.wireEncode(encoder);
-    }
-    EncodingHelper.encodeName(name, encoder);
-    encoder.writeTypeAndLength(TLV_FIB_ENTRY, encoder.getLength() - saveLength);
-  }
-
-  /**
-   * Decode the input from its TLV format.
-   *
-   * @param input The input buffer to decode. This reads from position() to
-   * limit(), but does not change the position.
-   * @throws EncodingException For invalid encoding.
-   */
-  public final void wireDecode(ByteBuffer input) throws EncodingException {
-    TlvDecoder decoder = new TlvDecoder(input);
-    wireDecode(decoder);
-  }
-
-  /**
-   * Decode as part of an existing decode context.
-   *
-   * @param decoder
-   * @throws EncodingException
-   */
-  @Override
-  public final void wireDecode(TlvDecoder decoder) throws EncodingException {
-    int endOffset = decoder.readNestedTlvsStart(TLV_FIB_ENTRY);
-    name = EncodingHelper.decodeName(decoder);
-    while (decoder.getOffset() < endOffset) {
-      NextHopRecord record = new NextHopRecord();
-      record.wireDecode(decoder);
-      records.add(record);
-    }
-    decoder.finishNestedTlvs(endOffset);
-  }
-
-  /**
-   * Get name
-   *
-   * @return
-   */
-  public Name getName() {
-    return name;
-  }
-
-  /**
-   * Set name
-   *
-   * @param name
-   */
-  public void setName(Name name) {
-    this.name = name;
-  }
-
-  /**
-   * Get records
-   *
-   * @return
-   */
-  public List<NextHopRecord> getRecords() {
-    return records;
-  }
-
-  /**
-   * Set records
-   *
-   * @param records
-   */
-  public void setRecords(List<NextHopRecord> records) {
-    this.records = records;
-  }
-
-  private Name name = new Name();
-  private List<NextHopRecord> records = new ArrayList<>();
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/ForwarderStatus.java b/app/src/main/java/com/intel/jndn/management/types/ForwarderStatus.java
deleted file mode 100644
index 6240bbd..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/ForwarderStatus.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-import java.nio.ByteBuffer;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a ForwarderStatus object from
- * http://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class ForwarderStatus implements Decodable {
-
-  public static final int TLV_NFD_VERSION = 0x80;
-  public static final int TLV_START_TIMESTAMP = 0x81;
-  public static final int TLV_CURRENT_TIMESTAMP = 0x82;
-  public static final int TLV_NUM_NAME_TREE_ENTRIES = 0x83;
-  public static final int TLV_NUM_FIB_ENTRIES = 0x84;
-  public static final int TLV_NUM_PIT_ENTRIES = 0x85;
-  public static final int TLV_NUM_MEASUREMENT_ENTRIES = 0x86;
-  public static final int TLV_NUM_CS_ENTRIES = 0x87;
-  public static final int TLV_NUM_IN_INTERESTS = 0x90;
-  public static final int TLV_NUM_IN_DATAS = 0x91;
-  public static final int TLV_NUM_OUT_INTERESTS = 0x92;
-  public static final int TLV_NUM_OUT_DATAS = 0x93;
-  public static final int TLV_NUM_IN_NACKS = 0x97;
-  public static final int TLV_NUM_OUT_NACKS = 0x98;
-
-  /**
-   * Encode using a new TLV encoder.
-   *
-   * @return The encoded buffer.
-   */
-  public final Blob wireEncode() {
-    TlvEncoder encoder = new TlvEncoder();
-    wireEncode(encoder);
-    return new Blob(encoder.getOutput(), false);
-  }
-
-  /**
-   * Encode as part of an existing encode context.
-   *
-   * @param encoder
-   */
-  public final void wireEncode(TlvEncoder encoder) {
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_OUT_NACKS, numOutNacks);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_OUT_DATAS, numOutDatas);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_OUT_INTERESTS, numOutInterests);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_IN_NACKS, numInNacks);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_IN_DATAS, numInDatas);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_IN_INTERESTS, numInInterests);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_CS_ENTRIES, numCsEntries);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_MEASUREMENT_ENTRIES, numMeasurementEntries);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_PIT_ENTRIES, numPitEntries);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_FIB_ENTRIES, numFibEntries);
-    encoder.writeNonNegativeIntegerTlv(TLV_NUM_NAME_TREE_ENTRIES, numNameTreeEntries);
-    encoder.writeNonNegativeIntegerTlv(TLV_CURRENT_TIMESTAMP, currentTimestamp);
-    encoder.writeNonNegativeIntegerTlv(TLV_START_TIMESTAMP, startTimestamp);
-    encoder.writeBlobTlv(TLV_NFD_VERSION, new Blob(nfdVersion).buf());
-  }
-
-  /**
-   * Decode the input from its TLV format.
-   *
-   * @param input The input buffer to decode. This reads from position() to
-   * limit(), but does not change the position.
-   * @throws EncodingException For invalid encoding.
-   */
-  public final void wireDecode(ByteBuffer input) throws EncodingException {
-    TlvDecoder decoder = new TlvDecoder(input);
-    wireDecode(decoder);
-  }
-
-  /**
-   * Decode as part of an existing decode context.
-   *
-   * @param decoder
-   * @throws EncodingException
-   */
-  @Override
-  public void wireDecode(TlvDecoder decoder) throws EncodingException {
-    this.nfdVersion = new Blob(decoder.readBlobTlv(TLV_NFD_VERSION), true).toString();
-    this.startTimestamp = decoder.readNonNegativeIntegerTlv(TLV_START_TIMESTAMP);
-    this.currentTimestamp = decoder.readNonNegativeIntegerTlv(TLV_CURRENT_TIMESTAMP);
-    this.numNameTreeEntries = decoder.readNonNegativeIntegerTlv(TLV_NUM_NAME_TREE_ENTRIES);
-    this.numFibEntries = decoder.readNonNegativeIntegerTlv(TLV_NUM_FIB_ENTRIES);
-    this.numPitEntries = decoder.readNonNegativeIntegerTlv(TLV_NUM_PIT_ENTRIES);
-    this.numMeasurementEntries = decoder.readNonNegativeIntegerTlv(TLV_NUM_MEASUREMENT_ENTRIES);
-    this.numCsEntries = decoder.readNonNegativeIntegerTlv(TLV_NUM_CS_ENTRIES);
-    this.numInInterests = decoder.readNonNegativeIntegerTlv(TLV_NUM_IN_INTERESTS);
-    this.numInDatas = decoder.readNonNegativeIntegerTlv(TLV_NUM_IN_DATAS);
-    this.numInNacks = decoder.readNonNegativeIntegerTlv(TLV_NUM_IN_NACKS);
-    this.numOutInterests = decoder.readNonNegativeIntegerTlv(TLV_NUM_OUT_INTERESTS);
-    this.numOutDatas = decoder.readNonNegativeIntegerTlv(TLV_NUM_OUT_DATAS);
-    this.numOutNacks = decoder.readNonNegativeIntegerTlv(TLV_NUM_OUT_NACKS);
-  }
-
-  public String getNfdVersion() {
-    return nfdVersion;
-  }
-
-  public void setNfdVersion(String nfdVersion) {
-    this.nfdVersion = nfdVersion;
-  }
-
-  public long getStartTimestamp() {
-    return startTimestamp;
-  }
-
-  public void setStartTimestamp(long startTimestamp) {
-    this.startTimestamp = startTimestamp;
-  }
-
-  public long getCurrentTimestamp() {
-    return currentTimestamp;
-  }
-
-  public void setCurrentTimestamp(long currentTimestamp) {
-    this.currentTimestamp = currentTimestamp;
-  }
-
-  public long getNumNameTreeEntries() {
-    return numNameTreeEntries;
-  }
-
-  public void setNumNameTreeEntries(long numNameTreeEntries) {
-    this.numNameTreeEntries = numNameTreeEntries;
-  }
-
-  public long getNumFibEntries() {
-    return numFibEntries;
-  }
-
-  public void setNumFibEntries(long numFibEntries) {
-    this.numFibEntries = numFibEntries;
-  }
-
-  public long getNumPitEntries() {
-    return numPitEntries;
-  }
-
-  public void setNumPitEntries(long numPitEntries) {
-    this.numPitEntries = numPitEntries;
-  }
-
-  public long getNumMeasurementEntries() {
-    return numMeasurementEntries;
-  }
-
-  public void setNumMeasurementEntries(long numMeasurementEntries) {
-    this.numMeasurementEntries = numMeasurementEntries;
-  }
-
-  public long getNumCsEntries() {
-    return numCsEntries;
-  }
-
-  public void setNumCsEntries(long numCsEntries) {
-    this.numCsEntries = numCsEntries;
-  }
-
-  public long getNumInInterests() {
-    return numInInterests;
-  }
-
-  public void setNumInInterests(long numInInterests) {
-    this.numInInterests = numInInterests;
-  }
-
-  public long getNumInDatas() {
-    return numInDatas;
-  }
-
-  public void setNumInDatas(long numInDatas) {
-    this.numInDatas = numInDatas;
-  }
-
-  public long getNumInNacks() {
-    return numInNacks;
-  }
-
-  public void setNumInNacks(long numInNacks) {
-    this.numInNacks = numInNacks;
-  }
-
-  public long getNumOutInterests() {
-    return numOutInterests;
-  }
-
-  public void setNumOutInterests(long numOutInterests) {
-    this.numOutInterests = numOutInterests;
-  }
-
-  public long getNumOutDatas() {
-    return numOutDatas;
-  }
-
-  public void setNumOutDatas(long numOutDatas) {
-    this.numOutDatas = numOutDatas;
-  }
-
-  public long getNumOutNacks() {
-    return numOutNacks;
-  }
-
-  public void setNumOutNacks(long numOutNacks) {
-    this.numOutNacks = numOutNacks;
-  }
-
-  private String nfdVersion = "";
-  private long startTimestamp;
-  private long currentTimestamp;
-  private long numNameTreeEntries;
-  private long numFibEntries;
-  private long numPitEntries;
-  private long numMeasurementEntries;
-  private long numCsEntries;
-  private long numInInterests;
-  private long numInDatas;
-  private long numInNacks;
-  private long numOutInterests;
-  private long numOutDatas;
-  private long numOutNacks;
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/LinkType.java b/app/src/main/java/com/intel/jndn/management/types/LinkType.java
deleted file mode 100644
index a0f517c..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/LinkType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-/**
- * Indicate the type of communication link; used by FaceStatus See
- * <a href="http://redmine.named-data.net/projects/nfd/widi/FaceMgmt">http://redmine.named-data.net/projects/nfd/widi/FaceMgmt</a>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public enum LinkType {
-
-  POINT_TO_POINT(0),
-  MULTI_ACCESS(1);
-
-  LinkType(int value) {
-    value_ = value;
-  }
-
-  public final int getNumericValue() {
-    return value_;
-  }
-  private final int value_;
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/LocalControlHeader.java b/app/src/main/java/com/intel/jndn/management/types/LocalControlHeader.java
deleted file mode 100644
index 5ca393f..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/LocalControlHeader.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-/**
- * Define constants for local control header options. See
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Enable-a-LocalControlHeader-feature">http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Enable-a-LocalControlHeader-feature</a>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public enum LocalControlHeader {
-
-  INCOMING_FACE_ID(1),
-  NEXT_HOP_FACE_ID(2),
-  CACHING_POLICY(3);
-
-  LocalControlHeader(int value) {
-    value_ = value;
-  }
-
-  public final int getNumericValue() {
-    return value_;
-  }
-  private final int value_;
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/NextHopRecord.java b/app/src/main/java/com/intel/jndn/management/types/NextHopRecord.java
deleted file mode 100644
index 3b40104..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/NextHopRecord.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-import java.nio.ByteBuffer;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.Tlv;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a NextHopRecord in a FibEntry; see
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset">http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset</a>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class NextHopRecord {
-
-  public final static int TLV_NEXT_HOP_RECORD = 129;
-
-  /**
-   * Encode using a new TLV encoder.
-   *
-   * @return The encoded buffer.
-   */
-  public final Blob wireEncode() {
-    TlvEncoder encoder = new TlvEncoder();
-    wireEncode(encoder);
-    return new Blob(encoder.getOutput(), false);
-  }
-
-  /**
-   * Encode as part of an existing encode context.
-   *
-   * @param encoder
-   */
-  public final void wireEncode(TlvEncoder encoder) {
-    int saveLength = encoder.getLength();
-    encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Cost, cost);
-    encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId, faceId);
-    encoder.writeTypeAndLength(TLV_NEXT_HOP_RECORD, encoder.getLength() - saveLength);
-  }
-
-  /**
-   * Decode the input from its TLV format.
-   *
-   * @param input The input buffer to decode. This reads from position() to
-   * limit(), but does not change the position.
-   * @throws EncodingException For invalid encoding.
-   */
-  public final void wireDecode(ByteBuffer input) throws EncodingException {
-    TlvDecoder decoder = new TlvDecoder(input);
-    wireDecode(decoder);
-  }
-
-  /**
-   * Decode as part of an existing decode context.
-   *
-   * @param decoder
-   * @throws EncodingException
-   */
-  public final void wireDecode(TlvDecoder decoder) throws EncodingException {
-    int endOffset = decoder.readNestedTlvsStart(TLV_NEXT_HOP_RECORD);
-    this.faceId = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId);
-    this.cost = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_Cost);
-    decoder.finishNestedTlvs(endOffset);
-  }
-
-  /**
-   * Get face ID
-   *
-   * @return
-   */
-  public int getFaceId() {
-    return faceId;
-  }
-
-  /**
-   * Set face ID
-   *
-   * @param faceId
-   */
-  public void setFaceId(int faceId) {
-    this.faceId = faceId;
-  }
-
-  /**
-   * Get cost
-   *
-   * @return
-   */
-  public int getCost() {
-    return cost;
-  }
-
-  /**
-   * Set cost
-   *
-   * @param cost
-   */
-  public void setCost(int cost) {
-    this.cost = cost;
-  }
-
-  private int faceId;
-  private int cost;
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/RibEntry.java b/app/src/main/java/com/intel/jndn/management/types/RibEntry.java
deleted file mode 100644
index 705352c..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/RibEntry.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-import com.intel.jndn.management.EncodingHelper;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a entry in the RIB; see
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#RIB-Dataset">http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#RIB-Dataset</a>
- * for details
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class RibEntry implements Decodable {
-
-  /**
-   * TLV type, see
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments">http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments</a>
-   */
-  public final static int TLV_RIB_ENTRY = 128;
-
-  /**
-   * Encode using a new TLV encoder.
-   *
-   * @return The encoded buffer.
-   */
-  public final Blob wireEncode() {
-    TlvEncoder encoder = new TlvEncoder();
-    wireEncode(encoder);
-    return new Blob(encoder.getOutput(), false);
-  }
-
-  /**
-   * Encode as part of an existing encode context.
-   *
-   * @param encoder
-   */
-  public final void wireEncode(TlvEncoder encoder) {
-    int saveLength = encoder.getLength();
-    for (Route route : routes) {
-      route.wireEncode(encoder);
-    }
-    EncodingHelper.encodeName(name, encoder);
-    encoder.writeTypeAndLength(TLV_RIB_ENTRY, encoder.getLength() - saveLength);
-  }
-
-  /**
-   * Decode the input from its TLV format.
-   *
-   * @param input The input buffer to decode. This reads from position() to
-   * limit(), but does not change the position.
-   * @throws EncodingException For invalid encoding.
-   */
-  public final void wireDecode(ByteBuffer input) throws EncodingException {
-    TlvDecoder decoder = new TlvDecoder(input);
-    wireDecode(decoder);
-  }
-
-  /**
-   * Decode as part of an existing decode context.
-   *
-   * @param decoder
-   * @throws EncodingException
-   */
-  @Override
-  public final void wireDecode(TlvDecoder decoder) throws EncodingException {
-    int endOffset = decoder.readNestedTlvsStart(TLV_RIB_ENTRY);
-    name = EncodingHelper.decodeName(decoder);
-    while (decoder.getOffset() < endOffset) {
-      Route route = new Route();
-      route.wireDecode(decoder);
-      routes.add(route);
-    }
-    decoder.finishNestedTlvs(endOffset);
-  }
-
-  /**
-   * Get name
-   *
-   * @return
-   */
-  public Name getName() {
-    return name;
-  }
-
-  /**
-   * Set name
-   *
-   * @param name
-   */
-  public void setName(Name name) {
-    this.name = name;
-  }
-
-  /**
-   * Get routes
-   *
-   * @return
-   */
-  public List<Route> getRoutes() {
-    return routes;
-  }
-
-  /**
-   * Set routes
-   *
-   * @param routes
-   */
-  public void setRoutes(List<Route> routes) {
-    this.routes = routes;
-  }
-
-  private Name name = new Name();
-  private List<Route> routes = new ArrayList<>();
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/Route.java b/app/src/main/java/com/intel/jndn/management/types/Route.java
deleted file mode 100644
index b4badf0..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/Route.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-import net.named_data.jndn.encoding.tlv.Tlv;
-import java.nio.ByteBuffer;
-import net.named_data.jndn.ForwardingFlags;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a Route object from /localhost/nfd/rib/list; see
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#RIB-Dataset">http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#RIB-Dataset</a>
- * for details.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class Route {
-
-  /**
-   * TLV type, see
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments">http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments</a>
-   */
-  public final static int TLV_ROUTE = 129;
-
-  /**
-   * Encode using a new TLV encoder.
-   *
-   * @return The encoded buffer.
-   */
-  public final Blob wireEncode() {
-    TlvEncoder encoder = new TlvEncoder();
-    wireEncode(encoder);
-    return new Blob(encoder.getOutput(), false);
-  }
-
-  /**
-   * Encode as part of an existing encode context.
-   *
-   * @param encoder
-   */
-  public final void wireEncode(TlvEncoder encoder) {
-    int saveLength = encoder.getLength();
-    encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_ExpirationPeriod, faceId);
-    encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Flags, flags.getForwardingEntryFlags());
-    encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Cost, cost);
-    encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Origin, origin);
-    encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId, faceId);
-    encoder.writeTypeAndLength(TLV_ROUTE, encoder.getLength() - saveLength);
-  }
-
-  /**
-   * Decode the input from its TLV format.
-   *
-   * @param input The input buffer to decode. This reads from position() to
-   * limit(), but does not change the position.
-   * @throws net.named_data.jndn.encoding.EncodingException
-   */
-  public final void wireDecode(ByteBuffer input) throws EncodingException {
-    TlvDecoder decoder = new TlvDecoder(input);
-    wireDecode(decoder);
-  }
-
-  /**
-   * Decode as part of an existing decode context.
-   *
-   * @param decoder
-   * @throws EncodingException
-   */
-  public final void wireDecode(TlvDecoder decoder) throws EncodingException {
-    int endOffset = decoder.readNestedTlvsStart(TLV_ROUTE);
-    this.faceId = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId);
-    this.origin = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_Origin);
-    this.cost = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_Cost);
-    this.flags.setForwardingEntryFlags((int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_Flags));
-    this.expirationPeriod = (int) decoder.readOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_ExpirationPeriod, endOffset);
-    decoder.finishNestedTlvs(endOffset);
-  }
-
-  /**
-   * Get Face ID
-   *
-   * @return
-   */
-  public int getFaceId() {
-    return faceId;
-  }
-
-  /**
-   * Set Face ID
-   *
-   * @param faceId
-   */
-  public void setFaceId(int faceId) {
-    this.faceId = faceId;
-  }
-
-  /**
-   * Get origin
-   *
-   * @return
-   */
-  public int getOrigin() {
-    return origin;
-  }
-
-  /**
-   * Set origin
-   *
-   * @param origin
-   */
-  public void setOrigin(int origin) {
-    this.origin = origin;
-  }
-
-  /**
-   * Get cost
-   *
-   * @return
-   */
-  public int getCost() {
-    return cost;
-  }
-
-  /**
-   * Set cost
-   *
-   * @param cost
-   */
-  public void setCost(int cost) {
-    this.cost = cost;
-  }
-
-  /**
-   * Get flags
-   *
-   * @return
-   */
-  public ForwardingFlags getFlags() {
-    return flags;
-  }
-
-  /**
-   * Set flags
-   *
-   * @param flags
-   */
-  public void setFlags(ForwardingFlags flags) {
-    this.flags = flags;
-  }
-
-  /**
-   * Get expiration period
-   *
-   * @return
-   */
-  public double getExpirationPeriod() {
-    return expirationPeriod;
-  }
-
-  /**
-   * Set expiration period
-   *
-   * @param expirationPeriod
-   */
-  public void setExpirationPeriod(double expirationPeriod) {
-    this.expirationPeriod = expirationPeriod;
-  }
-
-  private int faceId = -1;
-  private int origin = -1;
-  private int cost = -1;
-  private ForwardingFlags flags = new ForwardingFlags();
-  private double expirationPeriod = -1.0;
-}
diff --git a/app/src/main/java/com/intel/jndn/management/types/StatusDataset.java b/app/src/main/java/com/intel/jndn/management/types/StatusDataset.java
deleted file mode 100644
index 0cc42c8..0000000
--- a/app/src/main/java/com/intel/jndn/management/types/StatusDataset.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.management.types;
-
-import com.intel.jndn.management.ManagementException;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Helper class to handle StatusDatasets, see
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/StatusDataset">http://redmine.named-data.net/projects/nfd/wiki/StatusDataset</a>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class StatusDataset {
-
-  /**
-   * Decode multiple status entries as part of a StatusDataset, see
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/StatusDataset">http://redmine.named-data.net/projects/nfd/wiki/StatusDataset</a>
-   *
-   * @param <T>
-   * @param statusDataset
-   * @param type
-   * @return
-   * @throws com.intel.jndn.management.ManagementException
-   */
-  public static final <T extends Decodable> List<T> wireDecode(Blob statusDataset, Class<T> type) throws ManagementException {
-    List<T> entries = new ArrayList<>();
-    int endOffset = statusDataset.size();
-    TlvDecoder decoder = new TlvDecoder(statusDataset.buf());
-    while (decoder.getOffset() < endOffset) {
-      try {
-        T entry = type.newInstance();
-        entry.wireDecode(decoder);
-        entries.add(entry);
-      } catch (EncodingException | IllegalAccessException | InstantiationException e) {
-        throw new ManagementException("Failed to read status dataset.", e);
-      }
-    }
-    return entries;
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/Client.java b/app/src/main/java/com/intel/jndn/utils/Client.java
deleted file mode 100644
index 6b09f9f..0000000
--- a/app/src/main/java/com/intel/jndn/utils/Client.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils;
-
-import java.io.IOException;
-import java.util.concurrent.Future;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-
-/**
- * Base functionality provided by all NDN clients in this package.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface Client {
-
-  /**
-   * Asynchronously request the Data for an Interest. This will send the
-   * Interest and return immediately; use futureData.get() to block until the
-   * Data returns (see Future) or manage the event processing independently.
-   *
-   * @param face
-   * @param interest
-   * @return
-   */
-  public Future<Data> getAsync(Face face, Interest interest);
-
-  /**
-   * Synchronously retrieve the Data for an Interest; this will block until
-   * complete (i.e. either data is received or the interest times out).
-   *
-   * @param face
-   * @param interest
-   * @return
-   * @throws java.io.IOException
-   */
-  public Data getSync(Face face, Interest interest) throws IOException;
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/DynamicServer.java b/app/src/main/java/com/intel/jndn/utils/DynamicServer.java
deleted file mode 100644
index 8206e27..0000000
--- a/app/src/main/java/com/intel/jndn/utils/DynamicServer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils;
-
-import com.intel.jndn.utils.server.RespondWithData;
-import com.intel.jndn.utils.server.Server;
-import java.io.IOException;
-
-/**
- * Defines the API for a {@link Server} producing {@link Data} packets
- * dynamically; in other words, when an {@link Interest} arrives, this server
- * will run a callback to determine what packet to send back. As good practice,
- * keep callback methods as short as possible.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface DynamicServer extends Server {
-
-  /**
-   * Set the callback method to run when an {@link Interest} packet is passed to
-   * this server. This method should either return a {@link Data} packet that
-   * satisfies the Interest or throw an Exception to avoid sending. Calling this
-   * method a second time should replace the callback.
-   *
-   * @param callback the callback instance
-   * @throws java.io.IOException if the server fails to register a prefix
-   */
-  public void respondUsing(RespondWithData callback) throws IOException;
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/InternalFace.java b/app/src/main/java/com/intel/jndn/utils/InternalFace.java
deleted file mode 100644
index 2850363..0000000
--- a/app/src/main/java/com/intel/jndn/utils/InternalFace.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils;
-
-/**
- * TODO waiting on Face to become overridable
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class InternalFace {
-
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/RepositoryServer.java b/app/src/main/java/com/intel/jndn/utils/RepositoryServer.java
deleted file mode 100644
index 0364eb7..0000000
--- a/app/src/main/java/com/intel/jndn/utils/RepositoryServer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils;
-
-import com.intel.jndn.utils.server.Server;
-import java.io.IOException;
-import net.named_data.jndn.Data;
-
-/**
- * Defines the API for a {@link Server} producing {@link Data} packets and
- * storing them until they are requested; this server corresponds closely to use
- * cases such as: cache, file system, web server.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface RepositoryServer extends Server {
-
-  /**
-   * Store a {@link Data} packet in the server's repository until requested. The
-   * task of removing (or retaining) stale packets is not specified here but
-   * left to the implementation.
-   *
-   * @param data the {@link Data} packet to store and serve
-   * @throws IOException if the underlying server fails to store the packet
-   */
-  public void serve(Data data) throws IOException;
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/SegmentedClient.java b/app/src/main/java/com/intel/jndn/utils/SegmentedClient.java
deleted file mode 100644
index 2879a29..0000000
--- a/app/src/main/java/com/intel/jndn/utils/SegmentedClient.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils;
-
-import com.intel.jndn.utils.client.SegmentedFutureData;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-
-import net.named_data.nfd.utils.G;
-
-/**
- * Provide a client to simplify retrieving segmented Data packets over the NDN
- * network. This class expects the Data producer to follow the NDN naming
- * conventions (see http://named-data.net/doc/tech-memos/naming-conventions.pdf)
- * and produce Data packets with a valid segment as the last component of their
- * name; additionally, at least the first packet should set the FinalBlockId of
- * the packet's MetaInfo (see
- * http://named-data.net/doc/ndn-tlv/data.html#finalblockid).
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class SegmentedClient implements Client {
-
-  private static SegmentedClient defaultInstance;
-  private static final Logger logger = Logger.getLogger(SegmentedClient.class.getName());
-
-  /**
-   * Singleton access for simpler client use.
-   *
-   * @return
-   */
-  public static SegmentedClient getDefault() {
-    if (defaultInstance == null) {
-      defaultInstance = new SegmentedClient();
-    }
-    return defaultInstance;
-  }
-
-  /**
-   * Asynchronously send Interest packets for a segmented result; will block
-   * until the first packet is received and then send remaining interests until
-   * the specified FinalBlockId.
-   *
-   * @param face
-   * @param interest should include either a ChildSelector or an initial segment
-   * number; the initial segment number will be cut off in the de-segmented
-   * packet.
-   * @return a list of FutureData packets; if the first segment fails, the list
-   * will contain one FutureData with the failure exception
-   */
-  @Override
-  public Future<Data> getAsync(Face face, Interest interest) {
-    List<Future<Data>> segments = getAsyncList(face, interest);
-    Name name = hasSegment(interest.getName()) ? interest.getName().getPrefix(-1) : interest.getName();
-    return new SegmentedFutureData(name, segments);
-  }
-
-  /**
-   * Asynchronously send Interest packets for a segmented result; will block
-   * until the first packet is received and then send remaining interests until
-   * the specified FinalBlockId.
-   *
-   * @param face
-   * @param name the {@link Name} of the packet to retrieve using a default
-   * interest
-   * @return an aggregated data packet from all received segments
-   */
-  public Future<Data> getAsync(Face face, Name name) {
-    return getAsync(face, SimpleClient.getDefaultInterest(name));
-  }
-
-  /**
-   * Asynchronously send Interest packets for a segmented result; will block
-   * until the first packet is received and then send remaining interests until
-   * the specified FinalBlockId.
-   *
-   * @param face
-   * @param interest should include either a ChildSelector or an initial segment
-   * number
-   * @return a list of FutureData packets; if the first segment fails, the list
-   * will contain one FutureData with the failure exception
-   */
-  public List<Future<Data>> getAsyncList(Face face, Interest interest) {
-    // get first segment; default 0 or use a specified start segment
-    long firstSegment = 0;
-    boolean specifiedSegment = false;
-    try {
-      firstSegment = interest.getName().get(-1).toSegment();
-      specifiedSegment = true;
-    } catch (EncodingException e) {
-      // check for interest selector if no initial segment found
-      if (interest.getChildSelector() == -1) {
-        logger.log(Level.WARNING, "No child selector set for a segmented Interest; this may result in incorrect retrieval.");
-        // allow this interest to pass without a segment marker since it may still succeed
-      }
-    }
-
-    // setup segments
-    final List<Future<Data>> segments = new ArrayList<>();
-    segments.add(SimpleClient.getDefault().getAsync(face, interest));
-
-    // retrieve first packet to find last segment value
-    long lastSegment;
-    try {
-      G.Log("+++++++ " + segments.get(0).get().getMetaInfo().getFinalBlockId().toEscapedString());
-      lastSegment = segments.get(0).get().getMetaInfo().getFinalBlockId().toSegment();
-    } catch (ExecutionException | InterruptedException | EncodingException e) {
-      logger.log(Level.SEVERE, "Failed to retrieve first segment: ", e);
-      return segments;
-    }
-
-    // cut interest segment off
-    if (specifiedSegment) {
-      interest.setName(interest.getName().getPrefix(-1));
-    }
-
-    // send interests in remaining segments
-    for (long i = firstSegment + 1; i <= lastSegment; i++) {
-      Interest segmentedInterest = new Interest(interest);
-      segmentedInterest.getName().appendSegment(i);
-      Future<Data> futureData = SimpleClient.getDefault().getAsync(face, segmentedInterest);
-      segments.add((int) i, futureData);
-    }
-
-    return segments;
-  }
-
-  /**
-   * Asynchronously send Interests for a segmented Data packet using a default
-   * interest (e.g. 2 second timeout); this will block until complete (i.e.
-   * either data is received or the interest times out). See getAsync(Face face)
-   * for more information.
-   *
-   * @param face
-   * @param name
-   * @return
-   */
-  public List<Future<Data>> getAsyncList(Face face, Name name) {
-    return getAsyncList(face, SimpleClient.getDefaultInterest(name));
-  }
-
-  /**
-   * Retrieve a segmented Data packet; will block until all segments are
-   * received and will re-assemble these.
-   *
-   * @param face
-   * @param interest should include either a ChildSelector or an initial segment
-   * number
-   * @return a Data packet; the name will inherit from the sent Interest, not
-   * the returned packets and the content will be a concatenation of all of the
-   * packet contents.
-   * @throws java.io.IOException
-   */
-  @Override
-  public Data getSync(Face face, Interest interest) throws IOException {
-    try {
-      return getAsync(face, interest).get();
-    } catch (ExecutionException | InterruptedException e) {
-      logger.log(Level.WARNING, "Failed to retrieve data.", e);
-      throw new IOException("Failed to retrieve data.", e);
-    }
-  }
-
-  /**
-   * Synchronously retrieve the Data for a Name using a default interest (e.g. 2
-   * second timeout); this will block until complete (i.e. either data is
-   * received or the interest times out). See getSync(Face face) for more
-   * information.
-   *
-   * @param face
-   * @param name
-   * @return
-   * @throws java.io.IOException
-   */
-  public Data getSync(Face face, Name name) throws IOException {
-    return getSync(face, SimpleClient.getDefaultInterest(name));
-  }
-
-  /**
-   * Check if a name ends in a segment component; uses marker value found in the
-   * NDN naming conventions (see
-   * http://named-data.net/doc/tech-memos/naming-conventions.pdf).
-   *
-   * @param name
-   * @return
-   */
-  public static boolean hasSegment(Name name) {
-    return name.get(-1).getValue().buf().get(0) == 0x00;
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/SegmentedServer.java b/app/src/main/java/com/intel/jndn/utils/SegmentedServer.java
deleted file mode 100644
index 0daf0af..0000000
--- a/app/src/main/java/com/intel/jndn/utils/SegmentedServer.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils;
-
-import com.intel.jndn.utils.repository.ForLoopRepository;
-import com.intel.jndn.utils.repository.Repository;
-import com.intel.jndn.utils.server.SegmentedServerHelper;
-import com.intel.jndn.utils.server.ServerBaseImpl;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.transport.Transport;
-
-/**
- * Implementation of a {@link RepositoryServer} that segments packets stored in
- * its repository.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class SegmentedServer extends ServerBaseImpl implements RepositoryServer {
-
-  private static final Logger logger = Logger.getLogger(SegmentedClient.class.getName());
-  private final Repository repository = new ForLoopRepository();
-
-  /**
-   * {@inheritDoc}
-   */
-  public SegmentedServer(Face face, Name prefix) {
-    super(face, prefix);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void serve(Data data) throws IOException {
-    if (!isRegistered()) {
-      register();
-    }
-
-    InputStream stream = new ByteArrayInputStream(data.getContent().getImmutableArray());
-    List<Data> segments = SegmentedServerHelper.segment(data, stream);
-    for (Data segment : segments) {
-      logger.info("Added segment: " + segment.getName().toUri());
-      repository.put(segment);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void onInterest(Name prefix, Interest interest, Transport transport, long registeredPrefixId) {
-    if (interest.getChildSelector() == -1) {
-      try {
-        interest.getName().get(-1).toSegment();
-      } catch (EncodingException e) {
-        interest.setChildSelector(Interest.CHILD_SELECTOR_LEFT);
-      }
-    }
-
-    try {
-      Data data = repository.get(interest);
-      data = processPipeline(data);
-      ByteBuffer buffer = data.wireEncode().buf();
-      transport.send(buffer);
-    } catch (Exception e) {
-      logger.log(Level.SEVERE, "Failed to send data for: " + interest.toUri(), e);
-    }
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/SimpleClient.java b/app/src/main/java/com/intel/jndn/utils/SimpleClient.java
deleted file mode 100644
index a751f8e..0000000
--- a/app/src/main/java/com/intel/jndn/utils/SimpleClient.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils;
-
-import com.intel.jndn.utils.client.FutureData;
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Level;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.OnData;
-import net.named_data.jndn.OnTimeout;
-import java.util.logging.Logger;
-
-/**
- * Provide a client to simplify information retrieval over the NDN network.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class SimpleClient implements Client {
-
-  public static final long DEFAULT_SLEEP_TIME = 20;
-  public static final long DEFAULT_TIMEOUT = 2000;
-  private static final Logger logger = Logger.getLogger(SimpleClient.class.getName());
-  private static SimpleClient defaultInstance;
-
-  /**
-   * Singleton access for simpler client use
-   *
-   * @return
-   */
-  public static SimpleClient getDefault() {
-    if (defaultInstance == null) {
-      defaultInstance = new SimpleClient();
-    }
-    return defaultInstance;
-  }
-
-  /**
-   * Asynchronously request the Data for an Interest. This will send the
-   * Interest and return immediately; use futureData.get() to block until the
-   * Data returns (see FutureData) or manage the event processing independently.
-   *
-   * @param face
-   * @param interest
-   * @return
-   */
-  @Override
-  public Future<Data> getAsync(Face face, Interest interest) {
-    final FutureData futureData = new FutureData(face, interest.getName());
-
-    // send interest
-    try {
-      face.expressInterest(interest, new OnData() {
-        @Override
-        public void onData(Interest interest, Data data) {
-          futureData.resolve(data);
-        }
-      }, new OnTimeout() {
-        @Override
-        public void onTimeout(Interest interest) {
-          futureData.reject(new TimeoutException());
-        }
-      });
-    } catch (IOException e) {
-      logger.log(Level.WARNING, "IO failure while sending interest: ", e);
-      futureData.reject(e);
-    }
-
-    return futureData;
-  }
-
-  /**
-   * Synchronously retrieve the Data for a Name using a default interest (e.g. 2
-   * second timeout); this will block until complete (i.e. either data is
-   * received or the interest times out).
-   *
-   * @param face
-   * @param name
-   * @return
-   */
-  public Future<Data> getAsync(Face face, Name name) {
-    return getAsync(face, getDefaultInterest(name));
-  }
-
-  /**
-   * Synchronously retrieve the Data for an Interest; this will block until
-   * complete (i.e. either data is received or the interest times out).
-   *
-   * @param face
-   * @param interest
-   * @return Data packet or null
-   * @throws java.io.IOException
-   */
-  @Override
-  public Data getSync(Face face, Interest interest) throws IOException {
-    try {
-      return getAsync(face, interest).get();
-    } catch (ExecutionException | InterruptedException e) {
-      logger.log(Level.WARNING, "Failed to retrieve data.", e);
-      throw new IOException("Failed to retrieve data.", e);
-    }
-  }
-
-  /**
-   * Synchronously retrieve the Data for a Name using a default interest (e.g. 2
-   * second timeout); this will block until complete (i.e. either data is
-   * received or the interest times out).
-   *
-   * @param face
-   * @param name
-   * @return
-   * @throws java.io.IOException
-   */
-  public Data getSync(Face face, Name name) throws IOException {
-    return getSync(face, getDefaultInterest(name));
-  }
-
-  /**
-   * Create a default interest for a given Name using some common settings: -
-   * lifetime: 2 seconds
-   *
-   * @param name
-   * @return
-   */
-  public static Interest getDefaultInterest(Name name) {
-    Interest interest = new Interest(name, DEFAULT_TIMEOUT);
-    return interest;
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/SimpleServer.java b/app/src/main/java/com/intel/jndn/utils/SimpleServer.java
deleted file mode 100644
index 0bd4667..0000000
--- a/app/src/main/java/com/intel/jndn/utils/SimpleServer.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils;
-
-import com.intel.jndn.utils.server.RespondWithData;
-import com.intel.jndn.utils.server.RespondWithBlob;
-import com.intel.jndn.utils.server.ServerBaseImpl;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.transport.Transport;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Implementation of a {@link DynamicServer} that wraps the {@link OnInterest}
- * callback with some encoding and pipeline support.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class SimpleServer extends ServerBaseImpl implements DynamicServer {
-
-  private static final Logger logger = Logger.getLogger(SegmentedClient.class.getName());
-  private RespondWithData callback;
-
-  /**
-   * {@inheritDoc}
-   */
-  public SimpleServer(Face face, Name prefix) {
-    super(face, prefix);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void respondUsing(RespondWithData callback) throws IOException {
-    if (!isRegistered()) {
-      register();
-    }
-    this.callback = callback;
-  }
-
-  /**
-   * Convenience method for responding to an {@link Interest} by returning the
-   * {@link Blob} content only; when an Interest arrives, this method wraps the
-   * returned Blob with a {@link Data} using the exact {@link Name} of the
-   * incoming Interest.
-   *
-   * @param callback the callback function to retrieve content when an
-   * {@link Interest} arrives
-   * @throws java.io.IOException if the server fails to register a prefix
-   */
-  public void respondUsing(final RespondWithBlob callback) throws IOException {
-    RespondWithData dataCallback = new RespondWithData() {
-      @Override
-      public Data onInterest(Name prefix, Interest interest) throws Exception {
-        Data data = new Data(interest.getName());
-        Blob content = callback.onInterest(prefix, interest);
-        data.setContent(content);
-        return data;
-      }
-    };
-    respondUsing(dataCallback);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void onInterest(Name prefix, Interest interest, Transport transport, long registeredPrefixId) {
-    try {
-      Data data = callback.onInterest(prefix, interest);
-      data = processPipeline(data);
-      ByteBuffer buffer = data.wireEncode().buf();
-      transport.send(buffer);
-    } catch (Exception e) {
-      logger.log(Level.SEVERE, "Failed to send data for: " + interest.toUri(), e);
-    }
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/client/FutureData.java b/app/src/main/java/com/intel/jndn/utils/client/FutureData.java
deleted file mode 100644
index dc6b393..0000000
--- a/app/src/main/java/com/intel/jndn/utils/client/FutureData.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.client;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-
-/**
- * Reference to a Packet that has yet to be returned from the network. Usage:
- *
- * <pre><code>
- * FutureData futureData = new FutureData(face, interest.getName());
- * face.expressInterest(interest, new OnData(){
- *	... futureData.resolve(data); ...
- * }, new OnTimeout(){
- *  ... futureData.reject(new TimeoutException());
- * });
- * Data resolvedData = futureData.get(); // will block and call face.processEvents() until complete
- * </code></pre>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class FutureData implements Future<Data> {
-
-  protected final Face face;
-  private final Name name;
-  private Data data;
-  private boolean cancelled = false;
-  private Throwable error;
-
-  /**
-   * Constructor
-   *
-   * @param face
-   * @param name
-   */
-  public FutureData(Face face, Name name) {
-    this.face = face;
-    this.name = new Name(name);
-  }
-
-  /**
-   * Get the Interest name.
-   *
-   * @return
-   */
-  public Name getName() {
-    return name;
-  }
-
-  /**
-   * Cancel the current request.
-   *
-   * @param mayInterruptIfRunning
-   * @return
-   */
-  @Override
-  public boolean cancel(boolean mayInterruptIfRunning) {
-    cancelled = true;
-    return cancelled;
-  }
-
-  /**
-   * Determine if this request is cancelled.
-   *
-   * @return
-   */
-  @Override
-  public boolean isCancelled() {
-    return cancelled;
-  }
-
-  /**
-   * Determine if the request has completed (successfully or not).
-   *
-   * @return
-   */
-  @Override
-  public boolean isDone() {
-    return data != null || error != null || isCancelled();
-  }
-
-  /**
-   * Set the packet when successfully retrieved; unblocks get().
-   *
-   * @param d
-   */
-  public void resolve(Data d) {
-    data = d;
-  }
-
-  /**
-   * Set the exception when request failed; unblocks get().
-   *
-   * @param e
-   */
-  public void reject(Throwable e) {
-    error = e;
-  }
-
-  /**
-   * Block until packet is retrieved.
-   *
-   * @return
-   * @throws InterruptedException
-   * @throws ExecutionException
-   */
-  @Override
-  public Data get() throws InterruptedException, ExecutionException {
-    while (!isDone()) {
-      // process face events
-      try {
-        synchronized (face) {
-          face.processEvents();
-        }
-      } catch (EncodingException | IOException e) {
-        throw new ExecutionException("Failed to retrieve packet.", e);
-      }
-    }
-
-    // case: cancelled
-    if (cancelled) {
-      throw new InterruptedException("Interrupted by user.");
-    }
-
-    // case: error
-    if (error != null) {
-      throw new ExecutionException("Future rejected with error.", error);
-    }
-
-    return data;
-  }
-
-  /**
-   * Block until packet is retrieved or timeout is reached.
-   *
-   * @param timeout
-   * @param unit
-   * @return
-   * @throws InterruptedException
-   * @throws ExecutionException
-   * @throws TimeoutException
-   */
-  @Override
-  public Data get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
-    long interval = TimeUnit.MILLISECONDS.convert(timeout, unit);
-    long endTime = System.currentTimeMillis() + interval;
-    long currentTime = System.currentTimeMillis();
-    while (!isDone() && !isCancelled() && currentTime <= endTime) {
-      // process face events
-      try {
-        synchronized (face) {
-          face.processEvents();
-        }
-      } catch (EncodingException | IOException e) {
-        throw new ExecutionException("Failed to retrieve packet.", e);
-      }
-
-      currentTime = System.currentTimeMillis();
-    }
-
-    // case: cancelled
-    if (cancelled) {
-      throw new InterruptedException("Interrupted by user.");
-    }
-
-    // case: error
-    if (error != null) {
-      throw new ExecutionException("Future rejected with error.", error);
-    }
-
-    // case: timed out
-    if (currentTime > endTime) {
-      throw new TimeoutException("Timed out.");
-    }
-
-    return data;
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java b/app/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java
deleted file mode 100644
index dec33df..0000000
--- a/app/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.client;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represents a list of Packets that have been requested asynchronously and have
- * yet to be returned from the network. Usage:
- *
- * <pre><code>
- * SegmentedFutureData segmentedFutureData = new SegmentedFutureData(face, name, futureDataList);
- * Data data = segmentedFutureData.get(); // will block until complete
- * </code></pre>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class SegmentedFutureData implements Future<Data> {
-
-  private final Name name;
-  List<Future<Data>> segments;
-  private boolean cancelled = false;
-
-  /**
-   * Constructor
-   *
-   * @param name this will be the name of the returned Data packet, regardless
-   * of suffixes (e.g. segment components) on each segment packet
-   * @param segments
-   */
-  public SegmentedFutureData(Name name, List<Future<Data>> segments) {
-    this.name = name;
-    this.segments = segments;
-  }
-
-  /**
-   * Get the Interest name; this will also be the name of the Data packet
-   * returned from get().
-   *
-   * @return
-   */
-  public Name getName() {
-    return name;
-  }
-
-  /**
-   * Cancel the current request.
-   *
-   * @param mayInterruptIfRunning
-   * @return
-   */
-  @Override
-  public boolean cancel(boolean mayInterruptIfRunning) {
-    cancelled = true;
-    return cancelled;
-  }
-
-  /**
-   * Determine if this request is cancelled.
-   *
-   * @return
-   */
-  @Override
-  public boolean isCancelled() {
-    return cancelled;
-  }
-
-  /**
-   * Determine if the request has completed (successfully or not).
-   *
-   * @return
-   */
-  @Override
-  public boolean isDone() {
-    // check for errors, cancellation
-    if (isCancelled()) {
-      return true;
-    }
-
-    // check each segment for completion
-    for (Future<Data> futureData : segments) {
-      if (!futureData.isDone()) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-
-  /**
-   * Block until packet is retrieved.
-   *
-   * @return
-   * @throws InterruptedException
-   * @throws ExecutionException
-   */
-  @Override
-  public Data get() throws InterruptedException, ExecutionException {
-    // aggregate bytes
-    ByteArrayOutputStream content = new ByteArrayOutputStream();
-    for (Future<Data> futureData : segments) {
-      try {
-        content.write(futureData.get().getContent().getImmutableArray());
-      } catch (ExecutionException | IOException | InterruptedException e) {
-        throw new ExecutionException("Failed while aggregating retrieved packets.", e);
-      }
-    }
-
-    // build aggregated packet (copy first packet)
-    Data data = new Data(segments.get(0).get());
-    data.setName(getName());
-    data.setContent(new Blob(content.toByteArray()));
-    return data;
-  }
-
-  /**
-   * Block until packet is retrieved or timeout is reached.
-   *
-   * @param timeout
-   * @param unit
-   * @return
-   * @throws InterruptedException
-   * @throws ExecutionException
-   * @throws TimeoutException
-   */
-  @Override
-  public Data get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
-    long interval = TimeUnit.MILLISECONDS.convert(timeout, unit);
-    long endTime = System.currentTimeMillis() + interval;
-
-    // aggregate bytes
-    ByteArrayOutputStream content = new ByteArrayOutputStream();
-    for (Future<Data> futureData : segments) {
-      try {
-        content.write(futureData.get().getContent().getImmutableArray());
-      } catch (ExecutionException | IOException | InterruptedException e) {
-        throw new ExecutionException("Failed while aggregating retrieved packets.", e);
-      }
-
-      // check for timeout
-      if (System.currentTimeMillis() > endTime) {
-        throw new TimeoutException("Timed out.");
-      }
-    }
-
-    // build aggregated packet (copy first packet)
-    Data data = new Data(segments.get(0).get());
-    data.setName(getName());
-    data.setContent(new Blob(content.toByteArray()));
-    return data;
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/repository/DataNotFoundException.java b/app/src/main/java/com/intel/jndn/utils/repository/DataNotFoundException.java
deleted file mode 100644
index 732cc9c..0000000
--- a/app/src/main/java/com/intel/jndn/utils/repository/DataNotFoundException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.repository;
-
-/**
- * Thrown when a {@link Repository} cannot retrieve a stored packet.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class DataNotFoundException extends Exception {
-
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/repository/ForLoopRepository.java b/app/src/main/java/com/intel/jndn/utils/repository/ForLoopRepository.java
deleted file mode 100644
index cb43655..0000000
--- a/app/src/main/java/com/intel/jndn/utils/repository/ForLoopRepository.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.repository;
-
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-
-/**
- * Store {@link Data} packets in a linked list and iterate over the list to find
- * the best match; this is a subset of the functionality provided in
- * {@link net.named_data.jndn.util.MemoryContentCache} and borrows the matching
- * logic from there. Code for removing stale packets is not yet implemented.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class ForLoopRepository implements Repository {
-
-  private List<Data> storage = new ArrayList<>();
-
-  /**
-   * Helper data structure
-   */
-  private class Record {
-
-    public Name name;
-    public Data data;
-
-    public Record(Name name, Data data) {
-      this.name = name;
-      this.data = data;
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void put(Data data) {
-    storage.add(data);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Data get(Interest interest) throws DataNotFoundException {
-    Name.Component selectedComponent = null;
-    Data selectedData = null;
-    for (Data content : storage) {
-      if (interest.matchesName(content.getName())) {
-        if (interest.getChildSelector() < 0) {
-          // No child selector, so send the first match that we have found.
-          return content;
-        } else {
-          // Update selectedEncoding based on the child selector.
-          Name.Component component;
-          if (content.getName().size() > interest.getName().size()) {
-            component = content.getName().get(interest.getName().size());
-          } else {
-            component = new Name.Component();
-          }
-
-          boolean gotBetterMatch = false;
-          if (selectedData == null) {
-            // Save the first match.
-            gotBetterMatch = true;
-          } else {
-            if (interest.getChildSelector() == 0) {
-              // Leftmost child.
-              if (component.compare(selectedComponent) < 0) {
-                gotBetterMatch = true;
-              }
-            } else {
-              // Rightmost child.
-              if (component.compare(selectedComponent) > 0) {
-                gotBetterMatch = true;
-              }
-            }
-          }
-
-          if (gotBetterMatch) {
-            selectedComponent = component;
-            selectedData = content;
-          }
-        }
-      }
-    }
-
-    if (selectedData != null) {
-      // We found the leftmost or rightmost child.
-      return selectedData;
-    } else {
-      throw new DataNotFoundException();
-    }
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/repository/NavigableTreeRepository.java b/app/src/main/java/com/intel/jndn/utils/repository/NavigableTreeRepository.java
deleted file mode 100644
index ec47190..0000000
--- a/app/src/main/java/com/intel/jndn/utils/repository/NavigableTreeRepository.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.repository;
-
-import java.util.NavigableMap;
-import java.util.TreeMap;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-
-/**
- * Store {@link Data} packets in a {@link TreeMap}; this is an initial concept
- * class and should not be used in production. In tests, see
- * RepositoryTest.java, this class is faster on retrieval but not enough to make
- * up for its slow put().
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class NavigableTreeRepository implements Repository {
-
-  private NavigableMap<Name, PossibleData> storage = new TreeMap<>();
-
-  /**
-   * Helper data structure
-   */
-  private class PossibleData {
-
-    public PossibleData() {
-      // no data provided
-    }
-
-    public PossibleData(Data data) {
-      this.data = data;
-    }
-    public Data data;
-
-    public boolean hasData() {
-      return data != null;
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void put(Data data) {
-    storage.put(data.getName(), new PossibleData(data));
-
-    Name name = data.getName();
-    do {
-      name = name.getPrefix(-1);
-      if (storage.get(name) == null) {
-        storage.put(name, new PossibleData());
-      }
-    } while (name.size() > 0);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Data get(Interest interest) throws DataNotFoundException {
-    Data data;
-    if (interest.getChildSelector() == Interest.CHILD_SELECTOR_LEFT) {
-      data = getLowest(interest);
-    } else if (interest.getChildSelector() == Interest.CHILD_SELECTOR_RIGHT) {
-      data = getHighest(interest);
-    } else {
-      data = getFirstMatching(interest);
-    }
-    checkForNull(data);
-    return data;
-  }
-
-  /**
-   * @param interest the {@link Interest} to search with
-   * @return the lowest matching {@link Data} packet
-   */
-  private Data getLowest(Interest interest) {
-    PossibleData found = storage.get(interest.getName());
-
-    Name name = interest.getName();
-    while (found != null && interest.matchesName(name)) {
-      name = storage.lowerKey(name);
-      found = (name != null) ? storage.get(name) : null;
-    }
-
-    return found == null ? null : found.data;
-  }
-
-  /**
-   * @param interest the {@link Interest} to search with
-   * @return the highest matching {@link Data} packet
-   */
-  private Data getHighest(Interest interest) {
-    PossibleData found = storage.get(interest.getName());
-
-    if (found != null) {
-      Name name = interest.getName();
-      while (name != null && interest.matchesName(name)) {
-        found = storage.get(name);
-        name = storage.higherKey(name);
-      }
-    }
-
-    return found == null ? null : found.data;
-  }
-
-  /**
-   * @param interest the {@link Interest} to search with
-   * @return the first matching {@link Data} packet
-   */
-  private Data getFirstMatching(Interest interest) {
-    PossibleData found = storage.get(interest.getName());
-
-    Name name = interest.getName();
-    while (found != null && !found.hasData() && interest.matchesName(name)) {
-      name = storage.higherKey(name);
-      found = (name != null) ? storage.get(name) : null;
-    }
-
-    return found == null ? null : found.data;
-  }
-
-  /**
-   * @param data the {@link Data} packet to check
-   * @throws DataNotFoundException if data is null
-   */
-  private void checkForNull(Data data) throws DataNotFoundException {
-    if (data == null) {
-      throw new DataNotFoundException();
-    }
-  }
-
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/repository/Repository.java b/app/src/main/java/com/intel/jndn/utils/repository/Repository.java
deleted file mode 100644
index 9444e24..0000000
--- a/app/src/main/java/com/intel/jndn/utils/repository/Repository.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.repository;
-
-import com.intel.jndn.utils.repository.DataNotFoundException;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Interest;
-
-/**
- * Define API for storing and retrieving NDN packets
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface Repository {
-
-	/**
-	 * Put a {@link Data} packet in the repository.
-	 *
-	 * @param data a {@link Data} packet
-	 */
-	public void put(Data data);
-
-	/**
-	 * Retrieve a {@link Data} packet in the repository; this method should
-	 * respect child selectors, exclude selectors, etc.
-	 *
-	 * @param interest the {@link Interest}
-	 * @return a {@link Data} packet
-	 * @throws DataNotFoundException if the packet is not found
-	 */
-	public Data get(Interest interest) throws DataNotFoundException;
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/server/PipelineStage.java b/app/src/main/java/com/intel/jndn/utils/server/PipelineStage.java
deleted file mode 100644
index 15d23f0..0000000
--- a/app/src/main/java/com/intel/jndn/utils/server/PipelineStage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.server;
-
-/**
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface PipelineStage<T, Y> {
-  public Y process(T context) throws Exception;
-//  public void setNextStage(PipelineStage<Y, ?> nextStage);
-//  public PipelineStage<Y, ?> getNextStage();
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java b/app/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java
deleted file mode 100644
index fe7f74a..0000000
--- a/app/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.server;
-
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Functional interface for serving data from Server.on()
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface RespondWithBlob {
-
-  public Blob onInterest(Name prefix, Interest interest) throws Exception;
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/server/RespondWithData.java b/app/src/main/java/com/intel/jndn/utils/server/RespondWithData.java
deleted file mode 100644
index 95d0e6a..0000000
--- a/app/src/main/java/com/intel/jndn/utils/server/RespondWithData.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.server;
-
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-
-/**
- * Functional interface for serving data from Server.on()
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface RespondWithData {
-
-  public Data onInterest(Name prefix, Interest interest) throws Exception;
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/server/SegmentedServerHelper.java b/app/src/main/java/com/intel/jndn/utils/server/SegmentedServerHelper.java
deleted file mode 100644
index 2e1f92c..0000000
--- a/app/src/main/java/com/intel/jndn/utils/server/SegmentedServerHelper.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.server;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Helper for segmenting an input stream into a list of Data packets. Current
- * use of the default segment size of 4096 (only for
- * {@link #segment(net.named_data.jndn.Data, java.io.InputStream)} is based on
- * several assumptions: NDN packet size was limited to 8000 at the time this was
- * written and signature size is unknown.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class SegmentedServerHelper {
-
-  public static final int DEFAULT_SEGMENT_SIZE = 4096;
-
-  /**
-   * Segment a stream of bytes into a list of Data packets; this must read all
-   * the bytes first in order to determine the end segment for FinalBlockId.
-   *
-   * @param template the {@link Data} packet to use for the segment {@link Name},
-   * {@link net.named_data.jndn.MetaInfo}, etc.
-   * @param bytes an {@link InputStream} to the bytes to segment
-   * @return a list of segmented {@link Data} packets
-   * @throws IOException if the stream fails
-   */
-  public static List<Data> segment(Data template, InputStream bytes) throws IOException {
-    return segment(template, bytes, DEFAULT_SEGMENT_SIZE);
-  }
-
-  /**
-   * Segment a stream of bytes into a list of Data packets; this must read all
-   * the bytes first in order to determine the end segment for FinalBlockId.
-   *
-   * @param template the {@link Data} packet to use for the segment {@link Name},
-   * {@link net.named_data.jndn.MetaInfo}, etc.
-   * @param bytes an {@link InputStream} to the bytes to segment
-   * @return a list of segmented {@link Data} packets
-   * @throws IOException if the stream fails
-   */
-  public static List<Data> segment(Data template, InputStream bytes, int segmentSize) throws IOException {
-    List<Data> segments = new ArrayList<>();
-    byte[] buffer_ = readAll(bytes);
-    int numBytes = buffer_.length;
-    int numPackets = (int) Math.ceil((double) numBytes / segmentSize);
-    ByteBuffer buffer = ByteBuffer.wrap(buffer_, 0, numBytes);
-    Name.Component lastSegment = Name.Component.fromNumberWithMarker(numPackets - 1, 0x00);
-
-    for (int i = 0; i < numPackets; i++) {
-      Data segment = new Data(template);
-      segment.getName().appendSegment(i);
-      segment.getMetaInfo().setFinalBlockId(lastSegment);
-      byte[] content = new byte[Math.min(segmentSize, buffer.remaining())];
-      buffer.get(content);
-      segment.setContent(new Blob(content));
-      segments.add(segment);
-    }
-
-    return segments;
-  }
-
-  /**
-   * Read all of the bytes in an input stream.
-   *
-   * @param bytes the {@link InputStream} of bytes to read
-   * @return an array of all bytes retrieved from the stream
-   * @throws IOException if the stream fails
-   */
-  public static byte[] readAll(InputStream bytes) throws IOException {
-    ByteArrayOutputStream builder = new ByteArrayOutputStream();
-    int read = bytes.read();
-    while (read != -1) {
-      builder.write(read);
-      read = bytes.read();
-    }
-    builder.flush();
-    bytes.close();
-    return builder.toByteArray();
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/server/Server.java b/app/src/main/java/com/intel/jndn/utils/server/Server.java
deleted file mode 100644
index ba4ff1c..0000000
--- a/app/src/main/java/com/intel/jndn/utils/server/Server.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.server;
-
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.OnInterest;
-
-/**
- * Base interface for defining a server; see descendant interfaces for different
- * modes of serving packets. This class extends {@link Runnable} expecting
- * implementing classes to do any necessary event processing in the
- * {@link Runnable#run()} block, thus allowing different ways to manage servers
- * (e.g. single-thread vs {@link ScheduledThreadPoolExecutor}.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface Server extends Runnable, OnInterest {
-
-  /**
-   * @return the {@link Name} prefix this server is serving on.
-   */
-  public Name getPrefix();
-
-  /**
-   * Add a stage to the server pipeline. Each stage should be processed once the
-   * server has the {@link Data} packet available to send (e.g. after a callback
-   * has produced a packet); also, stages should be processed in the order they
-   * are added.
-   *
-   * @param pipelineStage a Data-to-Data processing stage
-   */
-  public void addPipelineStage(PipelineStage<Data, Data> pipelineStage);
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/server/ServerBaseImpl.java b/app/src/main/java/com/intel/jndn/utils/server/ServerBaseImpl.java
deleted file mode 100644
index 0d150d6..0000000
--- a/app/src/main/java/com/intel/jndn/utils/server/ServerBaseImpl.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.server;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.ForwardingFlags;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.OnRegisterFailed;
-import net.named_data.jndn.encoding.EncodingException;
-
-/**
- * Base implementation for a {@link Server}.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public abstract class ServerBaseImpl implements Server {
-
-  private static final Logger logger = Logger.getLogger(ServerBaseImpl.class.getName());
-  private final Face face;
-  private final Name prefix;
-  private final List<PipelineStage> pipeline = new ArrayList<>();
-  private boolean registered = false;
-
-  /**
-   * Build the base server; register() must run separately and is run
-   * automatically on {@link #run()}.
-   *
-   * @param face a {@link Face} allowing prefix registration (see
-   * {@link Face#setCommandSigningInfo(net.named_data.jndn.security.KeyChain, net.named_data.jndn.Name)}
-   * @param prefix the {@link Name} to register
-   */
-  public ServerBaseImpl(Face face, Name prefix) {
-    this.face = face;
-    this.prefix = prefix;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Name getPrefix() {
-    return prefix;
-  }
-
-  /**
-   * @return true if the server has registered a prefix on the face
-   */
-  public boolean isRegistered() {
-    return registered;
-  }
-
-  /**
-   * Register a prefix for responding to interests.
-   *
-   * @throws java.io.IOException if IO fails
-   */
-  public void register() throws IOException {
-    registered = true;
-    try {
-      face.registerPrefix(prefix, this, new OnRegisterFailed() {
-        @Override
-        public void onRegisterFailed(Name prefix) {
-          registered = false;
-          logger.log(Level.SEVERE, "Failed to register prefix: " + prefix.toUri());
-        }
-      }, new ForwardingFlags());
-    } catch (net.named_data.jndn.security.SecurityException e) {
-      registered = false;
-      throw new IOException("Failed to communicate to face due to security error", e);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void addPipelineStage(PipelineStage<Data, Data> pipelineStage) {
-    pipeline.add(pipelineStage);
-  }
-
-  /**
-   * Process the {@link Data} before sending it; this runs the packet through
-   * each registered {@link PipelineStage} in order.
-   *
-   * @param data the {@link Data} to process
-   * @return a processed {@link Data} packet; no guarantee as to whether it is
-   * the same instance as passed in as a parameter (and likely not).
-   * @throws Exception if a pipeline stage fails
-   */
-  public Data processPipeline(Data data) throws Exception {
-    for (PipelineStage<Data, Data> stage : pipeline) {
-      data = stage.process(data);
-    }
-    return data;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void run() {
-    if (!isRegistered()) {
-      try {
-        register();
-      } catch (IOException ex) {
-        throw new RuntimeException("Failed to register prefix, aborting.", ex);
-      }
-    }
-
-    // continuously serve packets
-    while (true) {
-      try {
-        synchronized (face) {
-          face.processEvents();
-        }
-      } catch (IOException ex) {
-        logger.log(Level.SEVERE, "Failed to process events.", ex);
-      } catch (EncodingException ex) {
-        logger.log(Level.SEVERE, "Failed to parse bytes.", ex);
-      }
-    }
-  }
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/server/pipeline/CompressionStage.java b/app/src/main/java/com/intel/jndn/utils/server/pipeline/CompressionStage.java
deleted file mode 100644
index 687bde0..0000000
--- a/app/src/main/java/com/intel/jndn/utils/server/pipeline/CompressionStage.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.server.pipeline;
-
-import com.intel.jndn.utils.server.PipelineStage;
-import java.io.ByteArrayOutputStream;
-import java.util.zip.GZIPOutputStream;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Sample stage for compressing {@link Data} content using GZIP
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class CompressionStage implements PipelineStage<Data, Data> {
-
-  /**
-   * Compress and replace the {@link Data} content. Note: this stage will return
-   * the same {@link Data} instance and will modify only its content.
-   *
-   * @param context the {@link Data} packet
-   * @return the same packet but with GZIP-compressed content
-   * @throws Exception if compression fails
-   */
-  @Override
-  public Data process(Data context) throws Exception {
-    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-    try (GZIPOutputStream stream = new GZIPOutputStream(buffer)) {
-      stream.write(context.getContent().getImmutableArray(), 0, context.getContent().size());
-      stream.close();
-    }
-
-    context.setContent(new Blob(buffer.toByteArray()));
-    return context;
-  }
-
-}
diff --git a/app/src/main/java/com/intel/jndn/utils/server/pipeline/SigningStage.java b/app/src/main/java/com/intel/jndn/utils/server/pipeline/SigningStage.java
deleted file mode 100644
index 5296d89..0000000
--- a/app/src/main/java/com/intel/jndn/utils/server/pipeline/SigningStage.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- */
-package com.intel.jndn.utils.server.pipeline;
-
-import com.intel.jndn.utils.server.PipelineStage;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.security.KeyChain;
-import net.named_data.jndn.security.SecurityException;
-
-/**
- * As a part of a {@link com.intel.jndn.utils.ServerIn} pipeline, this stage
- * will sign a {@link Data} packet.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class SigningStage implements PipelineStage<Data, Data> {
-
-  private final KeyChain keyChain;
-  private final Name certificateName;
-
-  /**
-   * Default constructor.
-   *
-   * @param keyChain the {@link KeyChain} to use for signing
-   * @param certificateName the certificate to sign with
-   */
-  public SigningStage(KeyChain keyChain, Name certificateName) {
-    this.keyChain = keyChain;
-    this.certificateName = certificateName;
-  }
-
-  /**
-   * Build the stage using the default certificate name defined on the
-   * {@link KeyChain}.
-   *
-   * @param keyChain the {@link KeyChain} to use for signing
-   * @throws SecurityException if no default certificate is found
-   */
-  public SigningStage(KeyChain keyChain) throws SecurityException {
-    this.keyChain = keyChain;
-    this.certificateName = keyChain.getDefaultCertificateName();
-  }
-
-  /**
-   * Sign a {@link Data} packet.
-   *
-   * @param context the data packet to sign
-   * @return the signed data packet
-   * @throws Exception if signing fails
-   */
-  @Override
-  public Data process(Data context) throws Exception {
-    keyChain.sign(context, certificateName);
-    return context;
-  }
-}
diff --git a/app/src/main/java/net/named_data/nfd/FaceListFragment.java b/app/src/main/java/net/named_data/nfd/FaceListFragment.java
index 540201d..55d1860 100644
--- a/app/src/main/java/net/named_data/nfd/FaceListFragment.java
+++ b/app/src/main/java/net/named_data/nfd/FaceListFragment.java
@@ -45,7 +45,7 @@
 
 import net.named_data.jndn_xx.util.FaceUri;
 import net.named_data.nfd.utils.G;
-import net.named_data.nfd.utils.Nfdc;
+import net.named_data.nfd.utils.NfdcHelper;
 
 import java.util.HashSet;
 import java.util.List;
@@ -339,7 +339,7 @@
       }
 
       FaceStatus info = getItem(position);
-      holder.m_faceUri.setText(info.getUri());
+      holder.m_faceUri.setText(info.getRemoteUri());
       holder.m_faceId.setText(String.valueOf(info.getFaceId()));
 
       return convertView;
@@ -369,14 +369,14 @@
     protected Pair<List<FaceStatus>, Exception>
     doInBackground(Void... params) {
       Exception returnException = null;
-      Nfdc nfdc = new Nfdc();
+      NfdcHelper nfdcHelper = new NfdcHelper();
       List<FaceStatus> faceStatusList = null;
       try {
-        faceStatusList = nfdc.faceList();
+        faceStatusList = nfdcHelper.faceList();
       } catch (Exception e) {
         returnException = e;
       }
-      nfdc.shutdown();
+      nfdcHelper.shutdown();
       return new Pair<>(faceStatusList, returnException);
     }
 
@@ -421,17 +421,17 @@
     doInBackground(Set<Integer>... params) {
       Exception retval = null;
 
-      Nfdc nfdc = new Nfdc();
+      NfdcHelper nfdcHelper = new NfdcHelper();
       try {
         for (Set<Integer> faces : params) {
           for (int faceId : faces) {
-            nfdc.faceDestroy(faceId);
+            nfdcHelper.faceDestroy(faceId);
           }
         }
       } catch (Exception e) {
         retval = e;
       }
-      nfdc.shutdown();
+      nfdcHelper.shutdown();
 
       return retval;
     }
@@ -471,9 +471,9 @@
     doInBackground(Void... params)
     {
       try {
-        Nfdc nfdc = new Nfdc();
-        int faceId = nfdc.faceCreate(m_faceUri);
-        nfdc.shutdown();
+        NfdcHelper nfdcHelper = new NfdcHelper();
+        int faceId = nfdcHelper.faceCreate(m_faceUri);
+        nfdcHelper.shutdown();
         return "OK. Face id: " + String.valueOf(faceId);
       }
       catch (FaceUri.CanonizeError e) {
diff --git a/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java b/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java
index e9804cb..f37a455 100644
--- a/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java
+++ b/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java
@@ -31,10 +31,10 @@
 import android.widget.ArrayAdapter;
 import android.widget.TextView;
 
-import com.intel.jndn.management.types.FacePersistency;
-import com.intel.jndn.management.types.FaceScope;
+import com.intel.jndn.management.enums.FacePersistency;
+import com.intel.jndn.management.enums.FaceScope;
+import com.intel.jndn.management.enums.LinkType;
 import com.intel.jndn.management.types.FaceStatus;
-import com.intel.jndn.management.types.LinkType;
 
 import net.named_data.jndn.encoding.EncodingException;
 import net.named_data.jndn.util.Blob;
@@ -110,22 +110,21 @@
       // Creating list of items to be displayed
       m_listItems.add(new ListItem(R.string.face_id, String.valueOf(faceStatus.getFaceId())));
       m_listItems.add(new ListItem(R.string.local_face_uri, faceStatus.getLocalUri()));
-      m_listItems.add(new ListItem(R.string.remote_face_uri, faceStatus.getUri()));
+      m_listItems.add(new ListItem(R.string.remote_face_uri, faceStatus.getRemoteUri()));
       m_listItems.add(new ListItem(R.string.expires_in, faceStatus.getExpirationPeriod() < 0 ?
         getString(R.string.expire_never) :
         PeriodFormat.getDefault().print(new Period(faceStatus.getExpirationPeriod()))));
       m_listItems.add(new ListItem(R.string.face_scope, getScope(faceStatus.getFaceScope())));
-      m_listItems.add(new ListItem(R.string.face_persistency, getPersistency(
-        faceStatus.getFacePersistency())));
+      m_listItems.add(new ListItem(R.string.face_persistency, getPersistency(faceStatus.getFacePersistency())));
       m_listItems.add(new ListItem(R.string.link_type, getLinkType(faceStatus.getLinkType())));
       m_listItems.add(new ListItem(R.string.in_interests, String.valueOf(
-        faceStatus.getInInterests())));
-      m_listItems.add(new ListItem(R.string.in_data, String.valueOf(faceStatus.getInDatas())));
+        faceStatus.getNInInterests())));
+      m_listItems.add(new ListItem(R.string.in_data, String.valueOf(faceStatus.getNInDatas())));
       m_listItems.add(new ListItem(R.string.out_interests, String.valueOf(
-        faceStatus.getOutInterests())));
-      m_listItems.add(new ListItem(R.string.out_data, String.valueOf(faceStatus.getOutDatas())));
-      m_listItems.add(new ListItem(R.string.in_bytes, String.valueOf(faceStatus.getInBytes())));
-      m_listItems.add(new ListItem(R.string.out_bytes, String.valueOf(faceStatus.getOutBytes())));
+        faceStatus.getNOutInterests())));
+      m_listItems.add(new ListItem(R.string.out_data, String.valueOf(faceStatus.getNOutDatas())));
+      m_listItems.add(new ListItem(R.string.in_bytes, String.valueOf(faceStatus.getNInBytes())));
+      m_listItems.add(new ListItem(R.string.out_bytes, String.valueOf(faceStatus.getNOutBytes())));
 
       m_faceStatusAdapter = new FaceStatusAdapter(getActivity(), m_listItems);
     }
@@ -145,19 +144,19 @@
   private String
   getScope(FaceScope scope)
   {
-    return m_scopes[scope.getNumericValue()];
+    return m_scopes[scope.toInteger()];
   }
 
   private String
   getPersistency(FacePersistency persistency)
   {
-    return m_persistencies[persistency.getNumericValue()];
+    return m_persistencies[persistency.toInteger()];
   }
 
   private String
   getLinkType(LinkType linkType)
   {
-    return m_linkTypes[linkType.getNumericValue()];
+    return m_linkTypes[linkType.toInteger()];
   }
 
   /**
diff --git a/app/src/main/java/net/named_data/nfd/MainFragment.java b/app/src/main/java/net/named_data/nfd/MainFragment.java
index 96443c0..898b504 100644
--- a/app/src/main/java/net/named_data/nfd/MainFragment.java
+++ b/app/src/main/java/net/named_data/nfd/MainFragment.java
@@ -46,7 +46,7 @@
 
 import net.named_data.nfd.service.NfdService;
 import net.named_data.nfd.utils.G;
-import net.named_data.nfd.utils.Nfdc;
+import net.named_data.nfd.utils.NfdcHelper;
 
 import org.joda.time.Period;
 import org.joda.time.format.PeriodFormat;
@@ -104,6 +104,8 @@
     m_outInterestsView = (TextView)v.findViewById(R.id.out_interests);
     m_inDataView = (TextView)v.findViewById(R.id.in_data);
     m_outDataView = (TextView)v.findViewById(R.id.out_data);
+    m_inNacksView = (TextView)v.findViewById(R.id.in_nacks);
+    m_outNacksView = (TextView)v.findViewById(R.id.out_nacks);
 
     return v;
   }
@@ -319,9 +321,9 @@
     doInBackground(Void... voids)
     {
       try {
-        Nfdc nfdc = new Nfdc();
-        ForwarderStatus fs = nfdc.generalStatus();
-        nfdc.shutdown();
+        NfdcHelper nfdcHelper = new NfdcHelper();
+        ForwarderStatus fs = nfdcHelper.generalStatus();
+        nfdcHelper.shutdown();
         return fs;
       }
       catch (Exception e) {
@@ -343,18 +345,21 @@
         m_uptimeView.setText(PeriodFormat.getDefault().print(new Period(
           fs.getCurrentTimestamp() - fs.getStartTimestamp())));
         m_nameTreeEntriesView.setText(String.valueOf(
-          fs.getNumNameTreeEntries()));
-        m_fibEntriesView.setText(String.valueOf(fs.getNumFibEntries()));
-        m_pitEntriesView.setText(String.valueOf(fs.getNumPitEntries()));
+          fs.getNNameTreeEntries()));
+        m_fibEntriesView.setText(String.valueOf(fs.getNFibEntries()));
+        m_pitEntriesView.setText(String.valueOf(fs.getNPitEntries()));
         m_measurementEntriesView.setText(String.valueOf(
-          fs.getNumMeasurementEntries()));
-        m_csEntriesView.setText(String.valueOf(fs.getNumCsEntries()));
+          fs.getNMeasurementsEntries()));
+        m_csEntriesView.setText(String.valueOf(fs.getNCsEntries()));
 
-        m_inInterestsView.setText(String.valueOf(fs.getNumInInterests()));
-        m_outInterestsView.setText(String.valueOf(
-          fs.getNumOutInterests()));
-        m_inDataView.setText(String.valueOf(fs.getNumInDatas()));
-        m_outDataView.setText(String.valueOf(fs.getNumOutDatas()));
+        m_inInterestsView.setText(String.valueOf(fs.getNInInterests()));
+        m_outInterestsView.setText(String.valueOf(fs.getNOutInterests()));
+
+        m_inDataView.setText(String.valueOf(fs.getNInDatas()));
+        m_outDataView.setText(String.valueOf(fs.getNOutDatas()));
+
+        m_inNacksView.setText(String.valueOf(fs.getNInNacks()));
+        m_outNacksView.setText(String.valueOf(fs.getNOutNacks()));
 
         m_nfdStatusView.setVisibility(View.VISIBLE);
 
@@ -392,6 +397,8 @@
   private TextView m_outInterestsView;
   private TextView m_inDataView;
   private TextView m_outDataView;
+  private TextView m_inNacksView;
+  private TextView m_outNacksView;
 
   private Handler m_handler;
   private Runnable m_statusUpdateRunnable = new Runnable() {
diff --git a/app/src/main/java/net/named_data/nfd/RouteInfoFragment.java b/app/src/main/java/net/named_data/nfd/RouteInfoFragment.java
index a1979c4..f6e0b4f 100644
--- a/app/src/main/java/net/named_data/nfd/RouteInfoFragment.java
+++ b/app/src/main/java/net/named_data/nfd/RouteInfoFragment.java
@@ -16,6 +16,7 @@
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.intel.jndn.management.enums.RouteFlags;
 import com.intel.jndn.management.types.FaceStatus;
 import com.intel.jndn.management.types.RibEntry;
 import com.intel.jndn.management.types.Route;
@@ -23,7 +24,7 @@
 import net.named_data.jndn.encoding.EncodingException;
 import net.named_data.jndn.util.Blob;
 import net.named_data.nfd.utils.G;
-import net.named_data.nfd.utils.Nfdc;
+import net.named_data.nfd.utils.NfdcHelper;
 
 import java.util.HashMap;
 import java.util.List;
@@ -204,14 +205,14 @@
 
       if (m_faces != null) {
         FaceStatus status = m_faces.get(r.getFaceId());
-        faceInfo += " (" + status.getUri() + ")";
+        faceInfo += " (" + status.getRemoteUri() + ")";
       }
 
       holder.m_title.setText(faceInfo);
       holder.m_value.setText("origin: " + String.valueOf(r.getOrigin()) + " " +
                                "cost: " + String.valueOf(r.getCost()) + " " +
-                               (r.getFlags().getChildInherit() ? "ChildInherit " : "") +
-                               (r.getFlags().getCapture() ? "Capture " : "")
+                               ((r.getFlags() & RouteFlags.CHILD_INHERIT.toInteger()) > 0 ? "ChildInherit " : "") +
+                               ((r.getFlags() & RouteFlags.CAPTURE.toInteger()) > 0 ? "Capture " : "")
                              //            +
                              //          (r.getExpirationPeriod() > 0 ? "Expires in " + PeriodFormat.getDefault().print(new Period((int)(1000*r.getExpirationPeriod()))) : "")
       );
@@ -243,14 +244,14 @@
     protected Pair<List<FaceStatus>, Exception>
     doInBackground(Void... params) {
       Exception returnException = null;
-      Nfdc nfdc = new Nfdc();
+      NfdcHelper nfdcHelper = new NfdcHelper();
       List<FaceStatus> faceStatusList = null;
       try {
-        faceStatusList = nfdc.faceList();
+        faceStatusList = nfdcHelper.faceList();
       } catch (Exception e) {
         returnException = e;
       }
-      nfdc.shutdown();
+      nfdcHelper.shutdown();
       return new Pair<>(faceStatusList, returnException);
     }
 
diff --git a/app/src/main/java/net/named_data/nfd/RouteListFragment.java b/app/src/main/java/net/named_data/nfd/RouteListFragment.java
index e75fc3d..0d326b0 100644
--- a/app/src/main/java/net/named_data/nfd/RouteListFragment.java
+++ b/app/src/main/java/net/named_data/nfd/RouteListFragment.java
@@ -45,7 +45,7 @@
 import net.named_data.jndn.Name;
 import net.named_data.jndn_xx.util.FaceUri;
 import net.named_data.nfd.utils.G;
-import net.named_data.nfd.utils.Nfdc;
+import net.named_data.nfd.utils.NfdcHelper;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -64,7 +64,7 @@
      *
      * @param ribEntry RibEntry instance with information about the selected route
      */
-    public void onRouteItemSelected(RibEntry ribEntry);
+    void onRouteItemSelected(RibEntry ribEntry);
   }
 
   @Override
@@ -315,16 +315,16 @@
     @Override
     protected Pair<List<RibEntry>, Exception>
     doInBackground(Void... params) {
-      Nfdc nfdc = new Nfdc();
+      NfdcHelper nfdcHelper = new NfdcHelper();
       Exception returnException = null;
       List<RibEntry> routes = null;
       try {
-        routes = nfdc.ribList();
+        routes = nfdcHelper.ribList();
       }
       catch (Exception e) {
         returnException = e;
       }
-      nfdc.shutdown();
+      nfdcHelper.shutdown();
       return new Pair<>(routes, returnException);
     }
 
@@ -362,11 +362,11 @@
     protected String
     doInBackground(Void... params)
     {
-      Nfdc nfdc = new Nfdc();
+      NfdcHelper nfdcHelper = new NfdcHelper();
       try {
-        int faceId = nfdc.faceCreate(m_faceUri);
-        nfdc.ribRegisterPrefix(new Name(m_prefix), faceId, 10, true, false);
-        nfdc.shutdown();
+        int faceId = nfdcHelper.faceCreate(m_faceUri);
+        nfdcHelper.ribRegisterPrefix(new Name(m_prefix), faceId, 10, true, false);
+        nfdcHelper.shutdown();
         return "OK";
       }
       catch (FaceUri.CanonizeError e) {
@@ -379,7 +379,7 @@
         return "Error communicating with NFD (" + e.getMessage() + ")";
       }
       finally {
-        nfdc.shutdown();
+        nfdcHelper.shutdown();
       }
     }
 
diff --git a/app/src/main/java/net/named_data/nfd/utils/Nfdc.java b/app/src/main/java/net/named_data/nfd/utils/Nfdc.java
deleted file mode 100644
index b376501..0000000
--- a/app/src/main/java/net/named_data/nfd/utils/Nfdc.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2015 Regents of the University of California
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
- * See AUTHORS.md for complete list of NFD Android authors and contributors.
- *
- * NFD Android is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD Android 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD Android, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-package net.named_data.nfd.utils;
-
-import com.intel.jndn.management.NFD;
-import com.intel.jndn.management.types.FaceStatus;
-import com.intel.jndn.management.types.ForwarderStatus;
-import com.intel.jndn.management.types.RibEntry;
-
-import net.named_data.jndn.ControlParameters;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.ForwardingFlags;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.security.*;
-import net.named_data.jndn.security.identity.IdentityManager;
-import net.named_data.jndn.security.identity.MemoryIdentityStorage;
-import net.named_data.jndn.security.identity.MemoryPrivateKeyStorage;
-import net.named_data.jndn.security.policy.SelfVerifyPolicyManager;
-import net.named_data.jndn.util.Blob;
-import net.named_data.jndn_xx.util.FaceUri;
-
-import java.nio.ByteBuffer;
-import java.util.List;
-
-public class Nfdc
-{
-  public Nfdc()
-  {
-    final MemoryIdentityStorage identityStorage = new MemoryIdentityStorage();
-    final MemoryPrivateKeyStorage privateKeyStorage = new MemoryPrivateKeyStorage();
-    final KeyChain keyChain = new KeyChain(new IdentityManager(identityStorage, privateKeyStorage),
-                                           new SelfVerifyPolicyManager(identityStorage));
-
-    // Initialize the storage.
-    Name keyName = new Name("/fake-key/ksk-1426265597681");
-    Name certificateName = new Name("/fake-key/KEY/ksk-1426265597681/ID-CERT/%FD%00%00%01L%14%0D%E8%00");
-
-    try {
-      identityStorage.addKey(keyName, KeyType.RSA,
-                             new Blob(DEFAULT_RSA_PUBLIC_KEY_DER, false));
-      privateKeyStorage.setKeyPairForKeyName(keyName, KeyType.RSA,
-                                             DEFAULT_RSA_PUBLIC_KEY_DER,
-                                             DEFAULT_RSA_PRIVATE_KEY_DER);
-    }
-    catch (net.named_data.jndn.security.SecurityException e) {
-      // shouldn't really happen
-      /// @todo add logging
-    }
-    m_face.setCommandSigningInfo(keyChain, certificateName);
-  }
-
-  public void
-  shutdown()
-  {
-    m_face.shutdown();
-  }
-
-  /**
-   * Get general NFD status
-   */
-  public ForwarderStatus
-  generalStatus() throws Exception
-  {
-    return NFD.getForwarderStatus(m_face);
-  }
-
-
-  /**
-   * Adds a nexthop to a FIB entry
-   * <p>
-   * If the FIB entry does not exist, it is inserted automatically
-   */
-  public void
-  fibAddNextHop(Name prefix, int faceId, int cost)
-  {
-  }
-
-  /**
-   * Removes a nexthop from an existing FIB entry
-   * <p>
-   * If the last nexthop record in a FIB entry is removed, the FIB entry is also deleted
-   */
-  public void
-  fibRemoveNextHop(Name prefix, int faceId)
-  {
-  }
-
-  /**
-   * Registers name to the given faceId or faceUri
-   */
-  public void
-  ribRegisterPrefix(Name prefix, int faceId, int cost, boolean isChildInherit, boolean isCapture) throws Exception
-  {
-    ForwardingFlags flags = new ForwardingFlags();
-    flags.setChildInherit(isChildInherit);
-    flags.setCapture(isCapture);
-    NFD.register(m_face,
-                 new ControlParameters()
-                   .setName(prefix)
-                   .setFaceId(faceId)
-                   .setCost(cost)
-                   .setForwardingFlags(flags));
-  }
-
-  /**
-   * Unregisters name from the given faceId/faceUri
-   */
-  public void
-  ribUnregisterPrefix(Name prefix, int faceId) throws Exception
-  {
-    NFD.unregister(m_face,
-                   new ControlParameters()
-                     .setName(prefix)
-                     .setFaceId(faceId));
-  }
-
-  /**
-   * List all of routes (RIB entries)
-   */
-  public List<RibEntry>
-  ribList() throws Exception
-  {
-    return NFD.getRouteList(m_face);
-  }
-
-  /**
-   * Creates new face
-   * <p>
-   * This command allows creation of UDP unicast and TCP faces only
-   */
-  public int
-  faceCreate(String faceUri) throws Exception, FaceUri.Error, FaceUri.CanonizeError
-  {
-    return NFD.createFace(m_face, new FaceUri(faceUri).canonize().toString());
-  }
-
-  /**
-   * Destroys face
-   */
-  public void
-  faceDestroy(int faceId) throws Exception
-  {
-    NFD.destroyFace(m_face, faceId);
-  }
-
-  /**
-   * List all faces
-   */
-  public List<FaceStatus>
-  faceList() throws Exception
-  {
-    return NFD.getFaceList(m_face);
-  }
-
-  /**
-   * Sets the strategy for a namespace
-   */
-  public void
-  strategyChoiceSet(Name namespace, Name strategy)
-  {
-  }
-
-  /**
-   * Unset the strategy for a namespace
-   */
-  public void
-  strategyChoiceUnset(Name namespace)
-  {
-
-  }
-
-  /////////////////////////////////////////////////////////////////////////////
-
-  final private Face m_face = new Face();
-
-  // temporary hack
-
-  private static final ByteBuffer DEFAULT_RSA_PUBLIC_KEY_DER = toBuffer(new int[]{
-      0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
-      0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
-      0x00, 0xb8, 0x09, 0xa7, 0x59, 0x82, 0x84, 0xec, 0x4f, 0x06, 0xfa, 0x1c, 0xb2, 0xe1, 0x38, 0x93,
-      0x53, 0xbb, 0x7d, 0xd4, 0xac, 0x88, 0x1a, 0xf8, 0x25, 0x11, 0xe4, 0xfa, 0x1d, 0x61, 0x24, 0x5b,
-      0x82, 0xca, 0xcd, 0x72, 0xce, 0xdb, 0x66, 0xb5, 0x8d, 0x54, 0xbd, 0xfb, 0x23, 0xfd, 0xe8, 0x8e,
-      0xaf, 0xa7, 0xb3, 0x79, 0xbe, 0x94, 0xb5, 0xb7, 0xba, 0x17, 0xb6, 0x05, 0xae, 0xce, 0x43, 0xbe,
-      0x3b, 0xce, 0x6e, 0xea, 0x07, 0xdb, 0xbf, 0x0a, 0x7e, 0xeb, 0xbc, 0xc9, 0x7b, 0x62, 0x3c, 0xf5,
-      0xe1, 0xce, 0xe1, 0xd9, 0x8d, 0x9c, 0xfe, 0x1f, 0xc7, 0xf8, 0xfb, 0x59, 0xc0, 0x94, 0x0b, 0x2c,
-      0xd9, 0x7d, 0xbc, 0x96, 0xeb, 0xb8, 0x79, 0x22, 0x8a, 0x2e, 0xa0, 0x12, 0x1d, 0x42, 0x07, 0xb6,
-      0x5d, 0xdb, 0xe1, 0xf6, 0xb1, 0x5d, 0x7b, 0x1f, 0x54, 0x52, 0x1c, 0xa3, 0x11, 0x9b, 0xf9, 0xeb,
-      0xbe, 0xb3, 0x95, 0xca, 0xa5, 0x87, 0x3f, 0x31, 0x18, 0x1a, 0xc9, 0x99, 0x01, 0xec, 0xaa, 0x90,
-      0xfd, 0x8a, 0x36, 0x35, 0x5e, 0x12, 0x81, 0xbe, 0x84, 0x88, 0xa1, 0x0d, 0x19, 0x2a, 0x4a, 0x66,
-      0xc1, 0x59, 0x3c, 0x41, 0x83, 0x3d, 0x3d, 0xb8, 0xd4, 0xab, 0x34, 0x90, 0x06, 0x3e, 0x1a, 0x61,
-      0x74, 0xbe, 0x04, 0xf5, 0x7a, 0x69, 0x1b, 0x9d, 0x56, 0xfc, 0x83, 0xb7, 0x60, 0xc1, 0x5e, 0x9d,
-      0x85, 0x34, 0xfd, 0x02, 0x1a, 0xba, 0x2c, 0x09, 0x72, 0xa7, 0x4a, 0x5e, 0x18, 0xbf, 0xc0, 0x58,
-      0xa7, 0x49, 0x34, 0x46, 0x61, 0x59, 0x0e, 0xe2, 0x6e, 0x9e, 0xd2, 0xdb, 0xfd, 0x72, 0x2f, 0x3c,
-      0x47, 0xcc, 0x5f, 0x99, 0x62, 0xee, 0x0d, 0xf3, 0x1f, 0x30, 0x25, 0x20, 0x92, 0x15, 0x4b, 0x04,
-      0xfe, 0x15, 0x19, 0x1d, 0xdc, 0x7e, 0x5c, 0x10, 0x21, 0x52, 0x21, 0x91, 0x54, 0x60, 0x8b, 0x92,
-      0x41, 0x02, 0x03, 0x01, 0x00, 0x01
-    });
-
-  // Java uses an unencrypted PKCS #8 PrivateKeyInfo, not a PKCS #1 RSAPrivateKey.
-  private static final ByteBuffer DEFAULT_RSA_PRIVATE_KEY_DER = toBuffer(new int[]{
-      0x30, 0x82, 0x04, 0xbf, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
-      0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x04, 0xa9, 0x30, 0x82, 0x04, 0xa5, 0x02, 0x01,
-      0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xb8, 0x09, 0xa7, 0x59, 0x82, 0x84, 0xec, 0x4f, 0x06, 0xfa,
-      0x1c, 0xb2, 0xe1, 0x38, 0x93, 0x53, 0xbb, 0x7d, 0xd4, 0xac, 0x88, 0x1a, 0xf8, 0x25, 0x11, 0xe4,
-      0xfa, 0x1d, 0x61, 0x24, 0x5b, 0x82, 0xca, 0xcd, 0x72, 0xce, 0xdb, 0x66, 0xb5, 0x8d, 0x54, 0xbd,
-      0xfb, 0x23, 0xfd, 0xe8, 0x8e, 0xaf, 0xa7, 0xb3, 0x79, 0xbe, 0x94, 0xb5, 0xb7, 0xba, 0x17, 0xb6,
-      0x05, 0xae, 0xce, 0x43, 0xbe, 0x3b, 0xce, 0x6e, 0xea, 0x07, 0xdb, 0xbf, 0x0a, 0x7e, 0xeb, 0xbc,
-      0xc9, 0x7b, 0x62, 0x3c, 0xf5, 0xe1, 0xce, 0xe1, 0xd9, 0x8d, 0x9c, 0xfe, 0x1f, 0xc7, 0xf8, 0xfb,
-      0x59, 0xc0, 0x94, 0x0b, 0x2c, 0xd9, 0x7d, 0xbc, 0x96, 0xeb, 0xb8, 0x79, 0x22, 0x8a, 0x2e, 0xa0,
-      0x12, 0x1d, 0x42, 0x07, 0xb6, 0x5d, 0xdb, 0xe1, 0xf6, 0xb1, 0x5d, 0x7b, 0x1f, 0x54, 0x52, 0x1c,
-      0xa3, 0x11, 0x9b, 0xf9, 0xeb, 0xbe, 0xb3, 0x95, 0xca, 0xa5, 0x87, 0x3f, 0x31, 0x18, 0x1a, 0xc9,
-      0x99, 0x01, 0xec, 0xaa, 0x90, 0xfd, 0x8a, 0x36, 0x35, 0x5e, 0x12, 0x81, 0xbe, 0x84, 0x88, 0xa1,
-      0x0d, 0x19, 0x2a, 0x4a, 0x66, 0xc1, 0x59, 0x3c, 0x41, 0x83, 0x3d, 0x3d, 0xb8, 0xd4, 0xab, 0x34,
-      0x90, 0x06, 0x3e, 0x1a, 0x61, 0x74, 0xbe, 0x04, 0xf5, 0x7a, 0x69, 0x1b, 0x9d, 0x56, 0xfc, 0x83,
-      0xb7, 0x60, 0xc1, 0x5e, 0x9d, 0x85, 0x34, 0xfd, 0x02, 0x1a, 0xba, 0x2c, 0x09, 0x72, 0xa7, 0x4a,
-      0x5e, 0x18, 0xbf, 0xc0, 0x58, 0xa7, 0x49, 0x34, 0x46, 0x61, 0x59, 0x0e, 0xe2, 0x6e, 0x9e, 0xd2,
-      0xdb, 0xfd, 0x72, 0x2f, 0x3c, 0x47, 0xcc, 0x5f, 0x99, 0x62, 0xee, 0x0d, 0xf3, 0x1f, 0x30, 0x25,
-      0x20, 0x92, 0x15, 0x4b, 0x04, 0xfe, 0x15, 0x19, 0x1d, 0xdc, 0x7e, 0x5c, 0x10, 0x21, 0x52, 0x21,
-      0x91, 0x54, 0x60, 0x8b, 0x92, 0x41, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, 0x01, 0x01, 0x00,
-      0x8a, 0x05, 0xfb, 0x73, 0x7f, 0x16, 0xaf, 0x9f, 0xa9, 0x4c, 0xe5, 0x3f, 0x26, 0xf8, 0x66, 0x4d,
-      0xd2, 0xfc, 0xd1, 0x06, 0xc0, 0x60, 0xf1, 0x9f, 0xe3, 0xa6, 0xc6, 0x0a, 0x48, 0xb3, 0x9a, 0xca,
-      0x21, 0xcd, 0x29, 0x80, 0x88, 0x3d, 0xa4, 0x85, 0xa5, 0x7b, 0x82, 0x21, 0x81, 0x28, 0xeb, 0xf2,
-      0x43, 0x24, 0xb0, 0x76, 0xc5, 0x52, 0xef, 0xc2, 0xea, 0x4b, 0x82, 0x41, 0x92, 0xc2, 0x6d, 0xa6,
-      0xae, 0xf0, 0xb2, 0x26, 0x48, 0xa1, 0x23, 0x7f, 0x02, 0xcf, 0xa8, 0x90, 0x17, 0xa2, 0x3e, 0x8a,
-      0x26, 0xbd, 0x6d, 0x8a, 0xee, 0xa6, 0x0c, 0x31, 0xce, 0xc2, 0xbb, 0x92, 0x59, 0xb5, 0x73, 0xe2,
-      0x7d, 0x91, 0x75, 0xe2, 0xbd, 0x8c, 0x63, 0xe2, 0x1c, 0x8b, 0xc2, 0x6a, 0x1c, 0xfe, 0x69, 0xc0,
-      0x44, 0xcb, 0x58, 0x57, 0xb7, 0x13, 0x42, 0xf0, 0xdb, 0x50, 0x4c, 0xe0, 0x45, 0x09, 0x8f, 0xca,
-      0x45, 0x8a, 0x06, 0xfe, 0x98, 0xd1, 0x22, 0xf5, 0x5a, 0x9a, 0xdf, 0x89, 0x17, 0xca, 0x20, 0xcc,
-      0x12, 0xa9, 0x09, 0x3d, 0xd5, 0xf7, 0xe3, 0xeb, 0x08, 0x4a, 0xc4, 0x12, 0xc0, 0xb9, 0x47, 0x6c,
-      0x79, 0x50, 0x66, 0xa3, 0xf8, 0xaf, 0x2c, 0xfa, 0xb4, 0x6b, 0xec, 0x03, 0xad, 0xcb, 0xda, 0x24,
-      0x0c, 0x52, 0x07, 0x87, 0x88, 0xc0, 0x21, 0xf3, 0x02, 0xe8, 0x24, 0x44, 0x0f, 0xcd, 0xa0, 0xad,
-      0x2f, 0x1b, 0x79, 0xab, 0x6b, 0x49, 0x4a, 0xe6, 0x3b, 0xd0, 0xad, 0xc3, 0x48, 0xb9, 0xf7, 0xf1,
-      0x34, 0x09, 0xeb, 0x7a, 0xc0, 0xd5, 0x0d, 0x39, 0xd8, 0x45, 0xce, 0x36, 0x7a, 0xd8, 0xde, 0x3c,
-      0xb0, 0x21, 0x96, 0x97, 0x8a, 0xff, 0x8b, 0x23, 0x60, 0x4f, 0xf0, 0x3d, 0xd7, 0x8f, 0xf3, 0x2c,
-      0xcb, 0x1d, 0x48, 0x3f, 0x86, 0xc4, 0xa9, 0x00, 0xf2, 0x23, 0x2d, 0x72, 0x4d, 0x66, 0xa5, 0x01,
-      0x02, 0x81, 0x81, 0x00, 0xdc, 0x4f, 0x99, 0x44, 0x0d, 0x7f, 0x59, 0x46, 0x1e, 0x8f, 0xe7, 0x2d,
-      0x8d, 0xdd, 0x54, 0xc0, 0xf7, 0xfa, 0x46, 0x0d, 0x9d, 0x35, 0x03, 0xf1, 0x7c, 0x12, 0xf3, 0x5a,
-      0x9d, 0x83, 0xcf, 0xdd, 0x37, 0x21, 0x7c, 0xb7, 0xee, 0xc3, 0x39, 0xd2, 0x75, 0x8f, 0xb2, 0x2d,
-      0x6f, 0xec, 0xc6, 0x03, 0x55, 0xd7, 0x00, 0x67, 0xd3, 0x9b, 0xa2, 0x68, 0x50, 0x6f, 0x9e, 0x28,
-      0xa4, 0x76, 0x39, 0x2b, 0xb2, 0x65, 0xcc, 0x72, 0x82, 0x93, 0xa0, 0xcf, 0x10, 0x05, 0x6a, 0x75,
-      0xca, 0x85, 0x35, 0x99, 0xb0, 0xa6, 0xc6, 0xef, 0x4c, 0x4d, 0x99, 0x7d, 0x2c, 0x38, 0x01, 0x21,
-      0xb5, 0x31, 0xac, 0x80, 0x54, 0xc4, 0x18, 0x4b, 0xfd, 0xef, 0xb3, 0x30, 0x22, 0x51, 0x5a, 0xea,
-      0x7d, 0x9b, 0xb2, 0x9d, 0xcb, 0xba, 0x3f, 0xc0, 0x1a, 0x6b, 0xcd, 0xb0, 0xe6, 0x2f, 0x04, 0x33,
-      0xd7, 0x3a, 0x49, 0x71, 0x02, 0x81, 0x81, 0x00, 0xd5, 0xd9, 0xc9, 0x70, 0x1a, 0x13, 0xb3, 0x39,
-      0x24, 0x02, 0xee, 0xb0, 0xbb, 0x84, 0x17, 0x12, 0xc6, 0xbd, 0x65, 0x73, 0xe9, 0x34, 0x5d, 0x43,
-      0xff, 0xdc, 0xf8, 0x55, 0xaf, 0x2a, 0xb9, 0xe1, 0xfa, 0x71, 0x65, 0x4e, 0x50, 0x0f, 0xa4, 0x3b,
-      0xe5, 0x68, 0xf2, 0x49, 0x71, 0xaf, 0x15, 0x88, 0xd7, 0xaf, 0xc4, 0x9d, 0x94, 0x84, 0x6b, 0x5b,
-      0x10, 0xd5, 0xc0, 0xaa, 0x0c, 0x13, 0x62, 0x99, 0xc0, 0x8b, 0xfc, 0x90, 0x0f, 0x87, 0x40, 0x4d,
-      0x58, 0x88, 0xbd, 0xe2, 0xba, 0x3e, 0x7e, 0x2d, 0xd7, 0x69, 0xa9, 0x3c, 0x09, 0x64, 0x31, 0xb6,
-      0xcc, 0x4d, 0x1f, 0x23, 0xb6, 0x9e, 0x65, 0xd6, 0x81, 0xdc, 0x85, 0xcc, 0x1e, 0xf1, 0x0b, 0x84,
-      0x38, 0xab, 0x93, 0x5f, 0x9f, 0x92, 0x4e, 0x93, 0x46, 0x95, 0x6b, 0x3e, 0xb6, 0xc3, 0x1b, 0xd7,
-      0x69, 0xa1, 0x0a, 0x97, 0x37, 0x78, 0xed, 0xd1, 0x02, 0x81, 0x80, 0x33, 0x18, 0xc3, 0x13, 0x65,
-      0x8e, 0x03, 0xc6, 0x9f, 0x90, 0x00, 0xae, 0x30, 0x19, 0x05, 0x6f, 0x3c, 0x14, 0x6f, 0xea, 0xf8,
-      0x6b, 0x33, 0x5e, 0xee, 0xc7, 0xf6, 0x69, 0x2d, 0xdf, 0x44, 0x76, 0xaa, 0x32, 0xba, 0x1a, 0x6e,
-      0xe6, 0x18, 0xa3, 0x17, 0x61, 0x1c, 0x92, 0x2d, 0x43, 0x5d, 0x29, 0xa8, 0xdf, 0x14, 0xd8, 0xff,
-      0xdb, 0x38, 0xef, 0xb8, 0xb8, 0x2a, 0x96, 0x82, 0x8e, 0x68, 0xf4, 0x19, 0x8c, 0x42, 0xbe, 0xcc,
-      0x4a, 0x31, 0x21, 0xd5, 0x35, 0x6c, 0x5b, 0xa5, 0x7c, 0xff, 0xd1, 0x85, 0x87, 0x28, 0xdc, 0x97,
-      0x75, 0xe8, 0x03, 0x80, 0x1d, 0xfd, 0x25, 0x34, 0x41, 0x31, 0x21, 0x12, 0x87, 0xe8, 0x9a, 0xb7,
-      0x6a, 0xc0, 0xc4, 0x89, 0x31, 0x15, 0x45, 0x0d, 0x9c, 0xee, 0xf0, 0x6a, 0x2f, 0xe8, 0x59, 0x45,
-      0xc7, 0x7b, 0x0d, 0x6c, 0x55, 0xbb, 0x43, 0xca, 0xc7, 0x5a, 0x01, 0x02, 0x81, 0x81, 0x00, 0xab,
-      0xf4, 0xd5, 0xcf, 0x78, 0x88, 0x82, 0xc2, 0xdd, 0xbc, 0x25, 0xe6, 0xa2, 0xc1, 0xd2, 0x33, 0xdc,
-      0xef, 0x0a, 0x97, 0x2b, 0xdc, 0x59, 0x6a, 0x86, 0x61, 0x4e, 0xa6, 0xc7, 0x95, 0x99, 0xa6, 0xa6,
-      0x55, 0x6c, 0x5a, 0x8e, 0x72, 0x25, 0x63, 0xac, 0x52, 0xb9, 0x10, 0x69, 0x83, 0x99, 0xd3, 0x51,
-      0x6c, 0x1a, 0xb3, 0x83, 0x6a, 0xff, 0x50, 0x58, 0xb7, 0x28, 0x97, 0x13, 0xe2, 0xba, 0x94, 0x5b,
-      0x89, 0xb4, 0xea, 0xba, 0x31, 0xcd, 0x78, 0xe4, 0x4a, 0x00, 0x36, 0x42, 0x00, 0x62, 0x41, 0xc6,
-      0x47, 0x46, 0x37, 0xea, 0x6d, 0x50, 0xb4, 0x66, 0x8f, 0x55, 0x0c, 0xc8, 0x99, 0x91, 0xd5, 0xec,
-      0xd2, 0x40, 0x1c, 0x24, 0x7d, 0x3a, 0xff, 0x74, 0xfa, 0x32, 0x24, 0xe0, 0x11, 0x2b, 0x71, 0xad,
-      0x7e, 0x14, 0xa0, 0x77, 0x21, 0x68, 0x4f, 0xcc, 0xb6, 0x1b, 0xe8, 0x00, 0x49, 0x13, 0x21, 0x02,
-      0x81, 0x81, 0x00, 0xb6, 0x18, 0x73, 0x59, 0x2c, 0x4f, 0x92, 0xac, 0xa2, 0x2e, 0x5f, 0xb6, 0xbe,
-      0x78, 0x5d, 0x47, 0x71, 0x04, 0x92, 0xf0, 0xd7, 0xe8, 0xc5, 0x7a, 0x84, 0x6b, 0xb8, 0xb4, 0x30,
-      0x1f, 0xd8, 0x0d, 0x58, 0xd0, 0x64, 0x80, 0xa7, 0x21, 0x1a, 0x48, 0x00, 0x37, 0xd6, 0x19, 0x71,
-      0xbb, 0x91, 0x20, 0x9d, 0xe2, 0xc3, 0xec, 0xdb, 0x36, 0x1c, 0xca, 0x48, 0x7d, 0x03, 0x32, 0x74,
-      0x1e, 0x65, 0x73, 0x02, 0x90, 0x73, 0xd8, 0x3f, 0xb5, 0x52, 0x35, 0x79, 0x1c, 0xee, 0x93, 0xa3,
-      0x32, 0x8b, 0xed, 0x89, 0x98, 0xf1, 0x0c, 0xd8, 0x12, 0xf2, 0x89, 0x7f, 0x32, 0x23, 0xec, 0x67,
-      0x66, 0x52, 0x83, 0x89, 0x99, 0x5e, 0x42, 0x2b, 0x42, 0x4b, 0x84, 0x50, 0x1b, 0x3e, 0x47, 0x6d,
-      0x74, 0xfb, 0xd1, 0xa6, 0x10, 0x20, 0x6c, 0x6e, 0xbe, 0x44, 0x3f, 0xb9, 0xfe, 0xbc, 0x8d, 0xda,
-      0xcb, 0xea, 0x8f
-    });
-
-  private static ByteBuffer
-  toBuffer(int[] array)
-  {
-    ByteBuffer result = ByteBuffer.allocate(array.length);
-    for (int i = 0; i < array.length; ++i)
-      result.put((byte) (array[i] & 0xff));
-
-    result.flip();
-    return result;
-  }
-}
diff --git a/app/src/main/java/net/named_data/nfd/utils/NfdcHelper.java b/app/src/main/java/net/named_data/nfd/utils/NfdcHelper.java
new file mode 100644
index 0000000..35854f0
--- /dev/null
+++ b/app/src/main/java/net/named_data/nfd/utils/NfdcHelper.java
@@ -0,0 +1,186 @@
+/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2015 Regents of the University of California
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
+ * See AUTHORS.md for complete list of NFD Android authors and contributors.
+ *
+ * NFD Android is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD Android 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD Android, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.named_data.nfd.utils;
+
+import com.intel.jndn.management.ManagementException;
+import com.intel.jndn.management.Nfdc;
+import com.intel.jndn.management.types.FaceStatus;
+import com.intel.jndn.management.types.ForwarderStatus;
+import com.intel.jndn.management.types.RibEntry;
+
+import net.named_data.jndn.ControlParameters;
+import net.named_data.jndn.Face;
+import net.named_data.jndn.ForwardingFlags;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.security.*;
+import net.named_data.jndn.security.SecurityException;
+import net.named_data.jndn.security.identity.IdentityManager;
+import net.named_data.jndn.security.identity.MemoryIdentityStorage;
+import net.named_data.jndn.security.identity.MemoryPrivateKeyStorage;
+import net.named_data.jndn.security.policy.SelfVerifyPolicyManager;
+import net.named_data.jndn_xx.util.FaceUri;
+
+import java.util.List;
+
+public class NfdcHelper
+{
+  public NfdcHelper()
+  {
+    m_face = new Face("localhost");
+    try {
+      m_face.setCommandSigningInfo(s_keyChain, s_keyChain.getDefaultCertificateName());
+    }
+    catch (SecurityException e) {
+      // shouldn't really happen
+      /// @todo add logging
+    }
+  }
+
+  public void
+  shutdown()
+  {
+    m_face.shutdown();
+  }
+
+  /**
+   * Get general NFD status
+   */
+  public ForwarderStatus
+  generalStatus() throws Exception
+  {
+    return Nfdc.getForwarderStatus(m_face);
+  }
+
+  /**
+   * Registers name to the given faceId or faceUri
+   */
+  public void
+  ribRegisterPrefix(Name prefix, int faceId, int cost, boolean isChildInherit, boolean isCapture) throws Exception
+  {
+    ForwardingFlags flags = new ForwardingFlags();
+    flags.setChildInherit(isChildInherit);
+    flags.setCapture(isCapture);
+    Nfdc.register(m_face,
+                  new ControlParameters()
+                    .setName(prefix)
+                    .setFaceId(faceId)
+                    .setCost(cost)
+                    .setForwardingFlags(flags));
+  }
+
+  /**
+   * Unregisters name from the given faceId/faceUri
+   */
+  public void
+  ribUnregisterPrefix(Name prefix, int faceId) throws Exception
+  {
+    Nfdc.unregister(m_face,
+                    new ControlParameters()
+                      .setName(prefix)
+                      .setFaceId(faceId));
+  }
+
+  /**
+   * List all of routes (RIB entries)
+   */
+  public List<RibEntry>
+  ribList() throws Exception
+  {
+    return Nfdc.getRouteList(m_face);
+  }
+
+  /**
+   * Creates new face
+   * <p>
+   * This command allows creation of UDP unicast and TCP faces only
+   */
+  public int
+  faceCreate(String faceUri) throws ManagementException, FaceUri.Error, FaceUri.CanonizeError
+  {
+    return Nfdc.createFace(m_face, new FaceUri(faceUri).canonize().toString());
+  }
+
+  /**
+   * Destroys face
+   */
+  public void
+  faceDestroy(int faceId) throws Exception
+  {
+    Nfdc.destroyFace(m_face, faceId);
+  }
+
+  /**
+   * List all faces
+   */
+  public List<FaceStatus>
+  faceList() throws Exception
+  {
+    return Nfdc.getFaceList(m_face);
+  }
+
+//  /**
+//   * Sets the strategy for a namespace
+//   */
+//  public void
+//  strategyChoiceSet(Name namespace, Name strategy)
+//  {
+//  }
+//
+//  /**
+//   * Unset the strategy for a namespace
+//   */
+//  public void
+//  strategyChoiceUnset(Name namespace)
+//  {
+//  }
+
+  /////////////////////////////////////////////////////////////////////////////
+
+  private static KeyChain
+  configureKeyChain() {
+    final MemoryIdentityStorage identityStorage = new MemoryIdentityStorage();
+    final MemoryPrivateKeyStorage privateKeyStorage = new MemoryPrivateKeyStorage();
+    final KeyChain keyChain = new KeyChain(new IdentityManager(identityStorage, privateKeyStorage),
+                                           new SelfVerifyPolicyManager(identityStorage));
+
+    Name name = new Name("/tmp-identity");
+
+    try {
+      // create keys, certs if necessary
+      if (!identityStorage.doesIdentityExist(name)) {
+        keyChain.createIdentityAndCertificate(name);
+
+        // set default identity
+        keyChain.getIdentityManager().setDefaultIdentity(name);
+      }
+    }
+    catch (SecurityException e){
+      // shouldn't really happen
+      /// @todo add logging
+    }
+
+    return keyChain;
+  }
+
+  /////////////////////////////////////////////////////////////////////////////
+
+  final static KeyChain s_keyChain = configureKeyChain();
+  private Face m_face;
+}
diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml
index 7a8c93a..2fb1d1f 100644
--- a/app/src/main/res/layout/fragment_main.xml
+++ b/app/src/main/res/layout/fragment_main.xml
@@ -126,6 +126,21 @@
                   style="@style/main_fragment_list_value" />
       </LinearLayout>
 
+      <LinearLayout style="@style/main_fragment_linear_layout">
+        <TextView style="@style/main_fragment_list_title"
+                  android:text="@string/in_nacks" />
+
+        <TextView android:id="@+id/in_nacks"
+                  style="@style/main_fragment_list_value" />
+      </LinearLayout>
+
+      <LinearLayout style="@style/main_fragment_linear_layout">
+        <TextView style="@style/main_fragment_list_title"
+                  android:text="@string/out_nacks" />
+
+        <TextView android:id="@+id/out_nacks"
+                  style="@style/main_fragment_list_value" />
+      </LinearLayout>
     </LinearLayout>
   </LinearLayout>
 </ScrollView>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9f65d2d..5691bdd 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -48,10 +48,12 @@
     <string name="out_data">Out data</string>
     <string name="in_bytes">In bytes</string>
     <string name="out_bytes">Out bytes</string>
+    <string name="in_nacks">In NACKs</string>
+    <string name="out_nacks">Out NACKs</string>
 
     <string-array name="face_scopes">
-        <item>Local</item>
         <item>Non-local</item>
+        <item>Local</item>
     </string-array>
 
     <string-array name="face_persistency">
