diff --git a/nb-configuration.xml b/nb-configuration.xml
index ae9d239..a191290 100644
--- a/nb-configuration.xml
+++ b/nb-configuration.xml
@@ -14,5 +14,13 @@
 Any value defined here will override the pom.xml file value but is only applicable to the current project.
 -->
         <netbeans.hint.license>intel-license</netbeans.hint.license>
+        <org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>2</org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>2</org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>true</org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>80</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>
+        <org-netbeans-modules-editor-indent.text.x-fortran.CodeStyle.project.text-limit-width>132</org-netbeans-modules-editor-indent.text.x-fortran.CodeStyle.project.text-limit-width>
     </properties>
 </project-shared-configuration>
diff --git a/src/main/java/com/intel/jndn/management/EncodingHelper.java b/src/main/java/com/intel/jndn/management/EncodingHelper.java
index 66e3b9d..ca2275b 100644
--- a/src/main/java/com/intel/jndn/management/EncodingHelper.java
+++ b/src/main/java/com/intel/jndn/management/EncodingHelper.java
@@ -30,113 +30,113 @@
  */
 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 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));
-		}
+  /**
+   * 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;
-	}
+    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 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 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();
+  /**
+   * 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 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 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);
-		}
+    // 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());
+    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());
-		}
+    // Encode URI
+    if (!controlParameters.getUri().isEmpty()) {
+      encoder.writeBlobTlv(Tlv.ControlParameters_Uri,
+              new Blob(controlParameters.getUri()).buf());
+    }
 
-		encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId, controlParameters.getFaceId());
+    encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId, controlParameters.getFaceId());
 
-		// Encode name
-		if (controlParameters.getName().size() != 0) {
-			encodeName(controlParameters.getName(), encoder);
-		}
+    // Encode name
+    if (controlParameters.getName().size() != 0) {
+      encodeName(controlParameters.getName(), encoder);
+    }
 
-		encoder.writeTypeAndLength(Tlv.ControlParameters_ControlParameters, encoder.getLength() - saveLength);
-	}
+    encoder.writeTypeAndLength(Tlv.ControlParameters_ControlParameters, encoder.getLength() - saveLength);
+  }
 }
diff --git a/src/main/java/com/intel/jndn/management/NFD.java b/src/main/java/com/intel/jndn/management/NFD.java
index b5f531f..8f8cdab 100644
--- a/src/main/java/com/intel/jndn/management/NFD.java
+++ b/src/main/java/com/intel/jndn/management/NFD.java
@@ -37,298 +37,298 @@
  */
 public class NFD {
 
-	public final static long DEFAULT_TIMEOUT = 2000;
-	static private final Logger logger = Logger.getLogger(NFD.class.getName());
+  public final static long DEFAULT_TIMEOUT = 2000;
+  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
-	 * @return true if successful, false otherwise
-	 */
-	public static boolean pingLocal(Face face) {
-		return ping(face, new Name("/localhost/nfd"));
-	}
+  /**
+   * 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
+   * @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);
+  /**
+   * 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
-		Data data = Client.getDefault().getSync(face, interest);
-		return data != null;
-	}
+    // send packet
+    Data data = Client.getDefault().getSync(face, interest);
+    return data != null;
+  }
 
-	/**
-	 * 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
-	 * @throws Exception
-	 */
-	public static List<FaceStatus> getFaceList(Face forwarder) throws Exception {
-		// build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
-		Interest interest = new Interest(new Name("/localhost/nfd/faces/list"));
-		interest.setMustBeFresh(true);
-		interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
-		interest.setInterestLifetimeMilliseconds(DEFAULT_TIMEOUT);
+  /**
+   * 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
+   * @throws Exception
+   */
+  public static List<FaceStatus> getFaceList(Face forwarder) throws Exception {
+    // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+    Interest interest = new Interest(new Name("/localhost/nfd/faces/list"));
+    interest.setMustBeFresh(true);
+    interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
+    interest.setInterestLifetimeMilliseconds(DEFAULT_TIMEOUT);
 
 		// TODO verify that all faces are being returned; right now they don't
-		// match up with the results from nfd-status-http-server but no 
-		// additional segments are present;  
-		// see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
-		// send packet
-		Data data = Client.getDefault().getSync(forwarder, interest);
-		if (data == null) {
-			throw new Exception("Failed to retrieve list of faces from the forwarder.");
-		}
+    // match up with the results from nfd-status-http-server but no 
+    // additional segments are present;  
+    // see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+    // send packet
+    Data data = Client.getDefault().getSync(forwarder, interest);
+    if (data == null) {
+      throw new Exception("Failed to retrieve list of faces from the forwarder.");
+    }
 
-		// parse packet
-		return StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
-	}
+    // parse packet
+    return StatusDataset.wireDecode(data.getContent(), FaceStatus.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
-	 * @throws Exception
-	 */
-	public static List<RibEntry> getRouteList(Face forwarder) throws Exception {
-		// build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
-		Interest interest = new Interest(new Name("/localhost/nfd/rib/list"));
-		interest.setMustBeFresh(true);
-		interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
-		interest.setInterestLifetimeMilliseconds(DEFAULT_TIMEOUT);
+  /**
+   * 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
+   * @throws Exception
+   */
+  public static List<RibEntry> getRouteList(Face forwarder) throws Exception {
+    // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+    Interest interest = new Interest(new Name("/localhost/nfd/rib/list"));
+    interest.setMustBeFresh(true);
+    interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
+    interest.setInterestLifetimeMilliseconds(DEFAULT_TIMEOUT);
 
-		// send packet
-		Data data = Client.getDefault().getSync(forwarder, interest);
-		if (data == null) {
-			throw new Exception("Failed to retrieve list of faces from the forwarder.");
-		}
+    // send packet
+    Data data = Client.getDefault().getSync(forwarder, interest);
+    if (data == null) {
+      throw new Exception("Failed to retrieve list of faces from the forwarder.");
+    }
 
-		// parse packet
-		return StatusDataset.wireDecode(data.getContent(), RibEntry.class);
-	}
+    // parse packet
+    return StatusDataset.wireDecode(data.getContent(), RibEntry.class);
+  }
 
-	/**
-	 * Helper method to register a new face on the forwarder; as mentioned at
-	 * http://named-data.net/doc/NFD/current/manpages/nfdc.html, this is more
-	 * for debugging; use 'register' instead
-	 *
-	 * @param forwarder Only a localhost Face
-	 * @param faceId
-	 * @param prefix
-	 * @return
-	 * @throws Exception
-	 */
-	public static boolean 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());
+  /**
+   * Helper method to register a new face on the forwarder; as mentioned at
+   * http://named-data.net/doc/NFD/current/manpages/nfdc.html, this is more for
+   * debugging; use 'register' instead
+   *
+   * @param forwarder Only a localhost Face
+   * @param faceId
+   * @param prefix
+   * @return
+   * @throws Exception
+   */
+  public static boolean 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
-		return sendCommandAndErrorCheck(forwarder, new Interest(command));
-	}
+    // send the interest
+    return sendCommandAndErrorCheck(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());
+  /**
+   * 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));
+    // send the interest
+    ControlResponse response = sendCommand(forwarder, new Interest(command));
 
-		// check for body and that status code is OK (TODO: 200 should be replaced with a CONSTANT like ControlResponse.STATUS_OK)
-		if (response.getBody().isEmpty() || response.getStatusCode() != 200) {
-			throw new Exception("Failed to create face: " + uri + " " + response.getStatusText());
-		}
+    // check for body and that status code is OK (TODO: 200 should be replaced with a CONSTANT like ControlResponse.STATUS_OK)
+    if (response.getBody().isEmpty() || response.getStatusCode() != 200) {
+      throw new Exception("Failed to create face: " + uri + " " + response.getStatusText());
+    }
 
-		// return
-		return response.getBody().get(0).getFaceId();
-	}
+    // return
+    return response.getBody().get(0).getFaceId();
+  }
 
-	/**
-	 * Register a route on the forwarder; see
-	 * http://named-data.net/doc/NFD/current/manpages/nfdc.html for command-line
-	 * usage and http://redmine.named-data.net/projects/nfd/wiki/RibMgmt 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
-	 * @return
-	 * @throws Exception
-	 */
-	public static boolean register(Face forwarder, ControlParameters controlParameters) throws Exception {
-		// build command name
-		Name command = new Name("/localhost/nfd/rib/register");
-		command.append(controlParameters.wireEncode());
+  /**
+   * Register a route on the forwarder; see
+   * http://named-data.net/doc/NFD/current/manpages/nfdc.html for command-line
+   * usage and http://redmine.named-data.net/projects/nfd/wiki/RibMgmt 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
+   * @return
+   * @throws Exception
+   */
+  public static boolean 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
-		return sendCommandAndErrorCheck(forwarder, new Interest(command));
-	}
+    // send the interest
+    return sendCommandAndErrorCheck(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
-	 * @return true for successful registration
-	 * @throws java.lang.Exception
-	 */
-	public static boolean register(Face forwarder, String uri, Name route, int cost) throws Exception {
-		// create the new face
-		int faceId = createFace(forwarder, uri);
+  /**
+   * 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
+   * @return true for successful registration
+   * @throws java.lang.Exception
+   */
+  public static boolean register(Face forwarder, String uri, Name route, int cost) throws Exception {
+    // create the new face
+    int faceId = createFace(forwarder, uri);
 
-		// run base method
-		return register(forwarder, faceId, route, cost);
-	}
+    // run base method
+    return 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
-	 * @return true for successful registration
-	 * @throws java.lang.Exception
-	 */
-	public static boolean 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);
+  /**
+   * 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
+   * @return true for successful registration
+   * @throws java.lang.Exception
+   */
+  public static boolean 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
-		return register(forwarder, parameters);
-	}
+    // run base method
+    return register(forwarder, parameters);
+  }
 
-	/**
-	 * Set a strategy on the forwarder; see
-	 * http://named-data.net/doc/NFD/current/manpages/nfdc.html for command-line
-	 * usage and http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice
-	 * 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
-	 * @return true for successful command
-	 * @throws Exception
-	 */
-	public static boolean 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());
+  /**
+   * Set a strategy on the forwarder; see
+   * http://named-data.net/doc/NFD/current/manpages/nfdc.html for command-line
+   * usage and http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice
+   * 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
+   * @return true for successful command
+   * @throws Exception
+   */
+  public static boolean 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
-		return sendCommandAndErrorCheck(forwarder, new Interest(command));
-	}
+    // send the interest
+    return sendCommandAndErrorCheck(forwarder, new Interest(command));
+  }
 
-	/**
-	 * 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
-	 * @param interest As described at
-	 * http://redmine.named-data.net/projects/nfd/wiki/ControlCommand, the
-	 * requested interest must have encoded ControlParameters appended to the
-	 * interest name
-	 * @return
-	 * @throws net.named_data.jndn.security.SecurityException
-	 * @throws java.io.IOException
-	 * @throws net.named_data.jndn.encoding.EncodingException
-	 */
-	public static ControlResponse sendCommand(Face forwarder, Interest interest) throws SecurityException, IOException, EncodingException {
-		forwarder.makeCommandInterest(interest);
+  /**
+   * 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
+   * @param interest As described at
+   * http://redmine.named-data.net/projects/nfd/wiki/ControlCommand, the
+   * requested interest must have encoded ControlParameters appended to the
+   * interest name
+   * @return
+   * @throws net.named_data.jndn.security.SecurityException
+   * @throws java.io.IOException
+   * @throws net.named_data.jndn.encoding.EncodingException
+   */
+  public static ControlResponse sendCommand(Face forwarder, Interest interest) throws SecurityException, IOException, EncodingException {
+    forwarder.makeCommandInterest(interest);
 
-		// send command packet
-		Data data = Client.getDefault().getSync(forwarder, interest);
-		if (data == null) {
-			throw new IOException("Failed to receive command response.");
-		}
+    // send command packet
+    Data data = Client.getDefault().getSync(forwarder, interest);
+    if (data == null) {
+      throw new IOException("Failed to receive command response.");
+    }
 
-		// return response
-		ControlResponse response = new ControlResponse();
-		response.wireDecode(data.getContent().buf());
-		return response;
-	}
+    // return response
+    ControlResponse response = new ControlResponse();
+    response.wireDecode(data.getContent().buf());
+    return response;
+  }
 
-	/**
-	 * 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.
-	 *
-	 * @param forwarder Only a localhost Face
-	 * @param interest As described at
-	 * http://redmine.named-data.net/projects/nfd/wiki/ControlCommand, the
-	 * requested interest must have encoded ControlParameters appended to the
-	 * interest name
-	 * @return
-	 * @throws net.named_data.jndn.security.SecurityException
-	 * @throws java.io.IOException
-	 * @throws net.named_data.jndn.encoding.EncodingException
-	 */
-	public static boolean sendCommandAndErrorCheck(Face forwarder, Interest interest) throws SecurityException, IOException, EncodingException {
-		ControlResponse response = sendCommand(forwarder, interest);
-		if (response.getStatusCode() < 400) {
-			return true;
-		} else {
-			logger.warning("Command sent but failed: " + response.getStatusCode() + " " + response.getStatusText());
-			return false;
-		}
-	}
+  /**
+   * 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.
+   *
+   * @param forwarder Only a localhost Face
+   * @param interest As described at
+   * http://redmine.named-data.net/projects/nfd/wiki/ControlCommand, the
+   * requested interest must have encoded ControlParameters appended to the
+   * interest name
+   * @return
+   * @throws net.named_data.jndn.security.SecurityException
+   * @throws java.io.IOException
+   * @throws net.named_data.jndn.encoding.EncodingException
+   */
+  public static boolean sendCommandAndErrorCheck(Face forwarder, Interest interest) throws SecurityException, IOException, EncodingException {
+    ControlResponse response = sendCommand(forwarder, interest);
+    if (response.getStatusCode() < 400) {
+      return true;
+    } else {
+      logger.warning("Command sent but failed: " + response.getStatusCode() + " " + response.getStatusText());
+      return false;
+    }
+  }
 }
diff --git a/src/main/java/com/intel/jndn/management/types/ControlResponse.java b/src/main/java/com/intel/jndn/management/types/ControlResponse.java
index 425f2d1..f068824 100644
--- a/src/main/java/com/intel/jndn/management/types/ControlResponse.java
+++ b/src/main/java/com/intel/jndn/management/types/ControlResponse.java
@@ -30,138 +30,138 @@
  */
 public class ControlResponse {
 
-	/**
-	 * Use TLV codes from jndn.encoding.tlv.Tlv.java See
-	 * http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
-	 */
-	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;
+  /**
+   * Use TLV codes from jndn.encoding.tlv.Tlv.java See
+   * http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
+   */
+  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 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);
-	}
+  /**
+   * 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 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);
+  /**
+   * 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();
+    // 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);
-		}
+    // 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);
-	}
+    decoder.finishNestedTlvs(endOffset);
+  }
 
-	/**
-	 * Get status code
-	 *
-	 * @return
-	 */
-	public int getStatusCode() {
-		return statusCode;
-	}
+  /**
+   * Get status code
+   *
+   * @return
+   */
+  public int getStatusCode() {
+    return statusCode;
+  }
 
-	/**
-	 * Set status code
-	 *
-	 * @param statusCode
-	 */
-	public void setStatusCode(int statusCode) {
-		this.statusCode = statusCode;
-	}
+  /**
+   * Set status code
+   *
+   * @param statusCode
+   */
+  public void setStatusCode(int statusCode) {
+    this.statusCode = statusCode;
+  }
 
-	/**
-	 * Get status text
-	 *
-	 * @return
-	 */
-	public String getStatusText() {
-		return statusText;
-	}
+  /**
+   * Get status text
+   *
+   * @return
+   */
+  public String getStatusText() {
+    return statusText;
+  }
 
-	/**
-	 * Set status text
-	 *
-	 * @param statusText
-	 */
-	public void setStatusText(String statusText) {
-		this.statusText = statusText;
-	}
+  /**
+   * Set status text
+   *
+   * @param statusText
+   */
+  public void setStatusText(String statusText) {
+    this.statusText = statusText;
+  }
 
-	/**
-	 * Get body
-	 *
-	 * @return
-	 */
-	public List<ControlParameters> getBody() {
-		return body;
-	}
+  /**
+   * Get body
+   *
+   * @return
+   */
+  public List<ControlParameters> getBody() {
+    return body;
+  }
 
-	/**
-	 * Set body
-	 *
-	 * @param body
-	 */
-	public void setBody(List<ControlParameters> body) {
-		this.body = 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<>();
+  private int statusCode = -1;
+  private String statusText = "";
+  private List<ControlParameters> body = new ArrayList<>();
 }
diff --git a/src/main/java/com/intel/jndn/management/types/Decodable.java b/src/main/java/com/intel/jndn/management/types/Decodable.java
index 17bb0fa..5aac4d6 100644
--- a/src/main/java/com/intel/jndn/management/types/Decodable.java
+++ b/src/main/java/com/intel/jndn/management/types/Decodable.java
@@ -21,5 +21,6 @@
  * @author Andrew Brown <andrew.brown@intel.com>
  */
 public interface Decodable {
-	public void wireDecode(TlvDecoder decoder) throws EncodingException;
+
+  public void wireDecode(TlvDecoder decoder) throws EncodingException;
 }
diff --git a/src/main/java/com/intel/jndn/management/types/FacePersistency.java b/src/main/java/com/intel/jndn/management/types/FacePersistency.java
index d663acc..61dbc3e 100644
--- a/src/main/java/com/intel/jndn/management/types/FacePersistency.java
+++ b/src/main/java/com/intel/jndn/management/types/FacePersistency.java
@@ -11,22 +11,23 @@
 package com.intel.jndn.management.types;
 
 /**
- * Indicate whether the face is persistent; used by FaceStatus
- * See http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
+ * Indicate whether the face is persistent; used by FaceStatus See
+ * http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
+ *
  * @author Andrew Brown <andrew.brown@intel.com>
  */
 public enum FacePersistency {
 
-	PERSISTENT(0),
-	ON_DEMAND(1),
-	PERMANENT(2);
+  PERSISTENT(0),
+  ON_DEMAND(1),
+  PERMANENT(2);
 
-	FacePersistency(int value) {
-		value_ = value;
-	}
+  FacePersistency(int value) {
+    value_ = value;
+  }
 
-	public final int getNumericValue() {
-		return value_;
-	}
-	private final int value_;
+  public final int getNumericValue() {
+    return value_;
+  }
+  private final int value_;
 }
diff --git a/src/main/java/com/intel/jndn/management/types/FaceScope.java b/src/main/java/com/intel/jndn/management/types/FaceScope.java
index 100befc..fec0acd 100644
--- a/src/main/java/com/intel/jndn/management/types/FaceScope.java
+++ b/src/main/java/com/intel/jndn/management/types/FaceScope.java
@@ -11,22 +11,22 @@
 package com.intel.jndn.management.types;
 
 /**
- * Indicate whether the face is local for scope control purposes; used by FaceStatus
- * See http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
+ * Indicate whether the face is local for scope control purposes; used by
+ * FaceStatus See http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
  *
  * @author andrew
  */
 public enum FaceScope {
 
-	LOCAL(0),
-	NON_LOCAL(1);
+  LOCAL(0),
+  NON_LOCAL(1);
 
-	FaceScope(int value) {
-		value_ = value;
-	}
+  FaceScope(int value) {
+    value_ = value;
+  }
 
-	public final int getNumericValue() {
-		return value_;
-	}
-	private final int value_;
+  public final int getNumericValue() {
+    return value_;
+  }
+  private final int value_;
 }
diff --git a/src/main/java/com/intel/jndn/management/types/FaceStatus.java b/src/main/java/com/intel/jndn/management/types/FaceStatus.java
index 6883d54..83b60e5 100644
--- a/src/main/java/com/intel/jndn/management/types/FaceStatus.java
+++ b/src/main/java/com/intel/jndn/management/types/FaceStatus.java
@@ -22,349 +22,350 @@
  *
  * @author Andrew Brown <andrew.brown@intel.com>
  */
-public class FaceStatus implements Decodable{
+public class FaceStatus implements Decodable {
 
-	/**
-	 * Spec from http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
-	 */
-	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 http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
+   */
+  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 http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
-	 */
-	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;
+  /**
+   * Spec from http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
+   */
+  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;
 
-	/**
-	 * 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 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_N_OUT_DATAS, outDatas);
-		encoder.writeNonNegativeIntegerTlv(TLV_N_OUT_INTERESTS, outInterests);
-		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);
-	}
+  /**
+   * 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_N_OUT_DATAS, outDatas);
+    encoder.writeNonNegativeIntegerTlv(TLV_N_OUT_INTERESTS, outInterests);
+    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 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.outInterests = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_INTERESTS);
-		this.outDatas = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_DATAS);
-		this.inBytes = (int) decoder.readNonNegativeIntegerTlv(TLV_N_IN_BYTES);
-		this.outBytes = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_BYTES);
-		decoder.finishNestedTlvs(endOffset);
-	}
+  /**
+   * 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.outInterests = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_INTERESTS);
+    this.outDatas = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_DATAS);
+    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;
-	}
+  /**
+   * Get face ID
+   *
+   * @return
+   */
+  public int getFaceId() {
+    return faceId;
+  }
 
-	/**
-	 * Set face ID
-	 * 
-	 * @param faceId 
-	 */
-	public void setFaceId(int faceId) {
-		this.faceId = faceId;
-	}
+  /**
+   * Set face ID
+   *
+   * @param faceId
+   */
+  public void setFaceId(int faceId) {
+    this.faceId = faceId;
+  }
 
-	/**
-	 * Get face ID
-	 *
-	 * @return
-	 */
-	public String getUri() {
-		return uri;
-	}
+  /**
+   * Get face ID
+   *
+   * @return
+   */
+  public String getUri() {
+    return uri;
+  }
 
-	/**
-	 * Set URI
-	 * 
-	 * @param uri 
-	 */
-	public void setUri(String uri) {
-		this.uri = uri;
-	}
+  /**
+   * Set URI
+   *
+   * @param uri
+   */
+  public void setUri(String uri) {
+    this.uri = uri;
+  }
 
-	/**
-	 * Get face ID
-	 *
-	 * @return
-	 */
-	public String getLocalUri() {
-		return localUri;
-	}
+  /**
+   * Get face ID
+   *
+   * @return
+   */
+  public String getLocalUri() {
+    return localUri;
+  }
 
-	/**
-	 * Set local URI
-	 * @param localUri 
-	 */
-	public void setLocalUri(String localUri) {
-		this.localUri = localUri;
-	}
+  /**
+   * Set local URI
+   *
+   * @param localUri
+   */
+  public void setLocalUri(String localUri) {
+    this.localUri = localUri;
+  }
 
-	/**
-	 * Get expiration period
-	 *
-	 * @return
-	 */
-	public int getExpirationPeriod() {
-		return expirationPeriod;
-	}
+  /**
+   * Get expiration period
+   *
+   * @return
+   */
+  public int getExpirationPeriod() {
+    return expirationPeriod;
+  }
 
-	/**
-	 * Set expiration period
-	 *
-	 * @param expirationPeriod
-	 */
-	public void setExpirationPeriod(int expirationPeriod) {
-		this.expirationPeriod = expirationPeriod;
-	}
+  /**
+   * Set expiration period
+   *
+   * @param expirationPeriod
+   */
+  public void setExpirationPeriod(int expirationPeriod) {
+    this.expirationPeriod = expirationPeriod;
+  }
 
-	/**
-	 * Get face scope value
-	 *
-	 * @return
-	 */
-	public FaceScope getFaceScope() {
-		return faceScope;
-	}
+  /**
+   * Get face scope value
+   *
+   * @return
+   */
+  public FaceScope getFaceScope() {
+    return faceScope;
+  }
 
-	/**
-	 * Set face scope value
-	 *
-	 * @param faceScope
-	 */
-	public void setFaceScope(FaceScope faceScope) {
-		this.faceScope = 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;
-	}
+  /**
+   * Get face persistency value
+   *
+   * @return
+   */
+  public FacePersistency getFacePersistency() {
+    return facePersistency;
+  }
 
-	/**
-	 * Set face persistency value
-	 *
-	 * @param facePersistency
-	 */
-	public void setFacePersistency(FacePersistency facePersistency) {
-		this.facePersistency = facePersistency;
-	}
+  /**
+   * Set face persistency value
+   *
+   * @param facePersistency
+   */
+  public void setFacePersistency(FacePersistency facePersistency) {
+    this.facePersistency = facePersistency;
+  }
 
-	/**
-	 * Get link type
-	 *
-	 * @return
-	 */
-	public LinkType getLinkType() {
-		return linkType;
-	}
+  /**
+   * Get link type
+   *
+   * @return
+   */
+  public LinkType getLinkType() {
+    return linkType;
+  }
 
-	/**
-	 * Set link type
-	 *
-	 * @param linkType
-	 */
-	public void setLinkType(LinkType linkType) {
-		this.linkType = 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * 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;
-	}
+  /**
+   * Set number of output bytes
+   *
+   * @param outBytes
+   */
+  public void setOutBytes(int outBytes) {
+    this.outBytes = outBytes;
+  }
 
-	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 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;
 }
diff --git a/src/main/java/com/intel/jndn/management/types/FibEntry.java b/src/main/java/com/intel/jndn/management/types/FibEntry.java
index 31cadbd..0478fe3 100644
--- a/src/main/java/com/intel/jndn/management/types/FibEntry.java
+++ b/src/main/java/com/intel/jndn/management/types/FibEntry.java
@@ -26,101 +26,101 @@
  *
  * @author Andrew Brown <andrew.brown@intel.com>
  */
-public class FibEntry implements Decodable{
+public class FibEntry implements Decodable {
 
-	public final static int TLV_FIB_ENTRY = 128;
+  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 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);
-	}
+  /**
+   * 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 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);
-	}
+  /**
+   * 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;
-	}
+  /**
+   * Get name
+   *
+   * @return
+   */
+  public Name getName() {
+    return name;
+  }
 
-	/**
-	 * Set name
-	 *
-	 * @param name
-	 */
-	public void setName(Name name) {
-		this.name = name;
-	}
+  /**
+   * Set name
+   *
+   * @param name
+   */
+  public void setName(Name name) {
+    this.name = name;
+  }
 
-	/**
-	 * Get records
-	 *
-	 * @return
-	 */
-	public List<NextHopRecord> getRecords() {
-		return records;
-	}
+  /**
+   * Get records
+   *
+   * @return
+   */
+  public List<NextHopRecord> getRecords() {
+    return records;
+  }
 
-	/**
-	 * Set records
-	 *
-	 * @param records
-	 */
-	public void setRecords(List<NextHopRecord> records) {
-		this.records = 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<>();
+  private Name name = new Name();
+  private List<NextHopRecord> records = new ArrayList<>();
 }
diff --git a/src/main/java/com/intel/jndn/management/types/LinkType.java b/src/main/java/com/intel/jndn/management/types/LinkType.java
index ea09f47..dc5fbf5 100644
--- a/src/main/java/com/intel/jndn/management/types/LinkType.java
+++ b/src/main/java/com/intel/jndn/management/types/LinkType.java
@@ -11,21 +11,22 @@
 package com.intel.jndn.management.types;
 
 /**
- * Indicate the type of communication link; used by FaceStatus
- * See http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
+ * Indicate the type of communication link; used by FaceStatus See
+ * http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
+ *
  * @author Andrew Brown <andrew.brown@intel.com>
  */
 public enum LinkType {
 
-	POINT_TO_POINT(0),
-	MULTI_ACCESS(1);
+  POINT_TO_POINT(0),
+  MULTI_ACCESS(1);
 
-	LinkType(int value) {
-		value_ = value;
-	}
+  LinkType(int value) {
+    value_ = value;
+  }
 
-	public final int getNumericValue() {
-		return value_;
-	}
-	private final int value_;
+  public final int getNumericValue() {
+    return value_;
+  }
+  private final int value_;
 }
diff --git a/src/main/java/com/intel/jndn/management/types/NextHopRecord.java b/src/main/java/com/intel/jndn/management/types/NextHopRecord.java
index b9001ad..a0e6915 100644
--- a/src/main/java/com/intel/jndn/management/types/NextHopRecord.java
+++ b/src/main/java/com/intel/jndn/management/types/NextHopRecord.java
@@ -26,92 +26,92 @@
  */
 public class NextHopRecord {
 
-	public final static int TLV_NEXT_HOP_RECORD = 129;
+  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 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);
-	}
+  /**
+   * 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 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);
-	}
+  /**
+   * 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;
-	}
+  /**
+   * Get face ID
+   *
+   * @return
+   */
+  public int getFaceId() {
+    return faceId;
+  }
 
-	/**
-	 * Set face ID
-	 *
-	 * @param faceId
-	 */
-	public void setFaceId(int faceId) {
-		this.faceId = faceId;
-	}
+  /**
+   * Set face ID
+   *
+   * @param faceId
+   */
+  public void setFaceId(int faceId) {
+    this.faceId = faceId;
+  }
 
-	/**
-	 * Get cost
-	 *
-	 * @return
-	 */
-	public int getCost() {
-		return cost;
-	}
+  /**
+   * Get cost
+   *
+   * @return
+   */
+  public int getCost() {
+    return cost;
+  }
 
-	/**
-	 * Set cost
-	 *
-	 * @param cost
-	 */
-	public void setCost(int cost) {
-		this.cost = cost;
-	}
+  /**
+   * Set cost
+   *
+   * @param cost
+   */
+  public void setCost(int cost) {
+    this.cost = cost;
+  }
 
-	private int faceId;
-	private int cost;
+  private int faceId;
+  private int cost;
 }
diff --git a/src/main/java/com/intel/jndn/management/types/RibEntry.java b/src/main/java/com/intel/jndn/management/types/RibEntry.java
index ac53810..19c7e7c 100644
--- a/src/main/java/com/intel/jndn/management/types/RibEntry.java
+++ b/src/main/java/com/intel/jndn/management/types/RibEntry.java
@@ -27,105 +27,105 @@
  *
  * @author Andrew Brown <andrew.brown@intel.com>
  */
-public class RibEntry implements Decodable{
+public class RibEntry implements Decodable {
 
-	/**
-	 * TLV type, see
-	 * http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments
-	 */
-	public final static int TLV_RIB_ENTRY = 128;
+  /**
+   * TLV type, see
+   * http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments
+   */
+  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 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);
-	}
+  /**
+   * 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 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);
-	}
+  /**
+   * 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;
-	}
+  /**
+   * Get name
+   *
+   * @return
+   */
+  public Name getName() {
+    return name;
+  }
 
-	/**
-	 * Set name
-	 *
-	 * @param name
-	 */
-	public void setName(Name name) {
-		this.name = name;
-	}
+  /**
+   * Set name
+   *
+   * @param name
+   */
+  public void setName(Name name) {
+    this.name = name;
+  }
 
-	/**
-	 * Get routes
-	 *
-	 * @return
-	 */
-	public List<Route> getRoutes() {
-		return routes;
-	}
+  /**
+   * Get routes
+   *
+   * @return
+   */
+  public List<Route> getRoutes() {
+    return routes;
+  }
 
-	/**
-	 * Set routes
-	 *
-	 * @param routes
-	 */
-	public void setRoutes(List<Route> routes) {
-		this.routes = 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<>();
+  private Name name = new Name();
+  private List<Route> routes = new ArrayList<>();
 }
diff --git a/src/main/java/com/intel/jndn/management/types/Route.java b/src/main/java/com/intel/jndn/management/types/Route.java
index 2cbb247..79be67f 100644
--- a/src/main/java/com/intel/jndn/management/types/Route.java
+++ b/src/main/java/com/intel/jndn/management/types/Route.java
@@ -28,159 +28,159 @@
  */
 public class Route {
 
-	/**
-	 * TLV type, see
-	 * http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments
-	 */
-	public final static int TLV_ROUTE = 129;
+  /**
+   * TLV type, see
+   * http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments
+   */
+  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 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);
-	}
+  /**
+   * 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 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);
-	}
+  /**
+   * 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;
-	}
+  /**
+   * Get Face ID
+   *
+   * @return
+   */
+  public int getFaceId() {
+    return faceId;
+  }
 
-	/**
-	 * Set Face ID
-	 *
-	 * @param faceId
-	 */
-	public void setFaceId(int faceId) {
-		this.faceId = faceId;
-	}
+  /**
+   * Set Face ID
+   *
+   * @param faceId
+   */
+  public void setFaceId(int faceId) {
+    this.faceId = faceId;
+  }
 
-	/**
-	 * Get origin
-	 *
-	 * @return
-	 */
-	public int getOrigin() {
-		return origin;
-	}
+  /**
+   * Get origin
+   *
+   * @return
+   */
+  public int getOrigin() {
+    return origin;
+  }
 
-	/**
-	 * Set origin
-	 *
-	 * @param origin
-	 */
-	public void setOrigin(int origin) {
-		this.origin = origin;
-	}
+  /**
+   * Set origin
+   *
+   * @param origin
+   */
+  public void setOrigin(int origin) {
+    this.origin = origin;
+  }
 
-	/**
-	 * Get cost
-	 *
-	 * @return
-	 */
-	public int getCost() {
-		return cost;
-	}
+  /**
+   * Get cost
+   *
+   * @return
+   */
+  public int getCost() {
+    return cost;
+  }
 
-	/**
-	 * Set cost
-	 *
-	 * @param cost
-	 */
-	public void setCost(int cost) {
-		this.cost = cost;
-	}
+  /**
+   * Set cost
+   *
+   * @param cost
+   */
+  public void setCost(int cost) {
+    this.cost = cost;
+  }
 
-	/**
-	 * Get flags
-	 *
-	 * @return
-	 */
-	public ForwardingFlags getFlags() {
-		return flags;
-	}
+  /**
+   * Get flags
+   *
+   * @return
+   */
+  public ForwardingFlags getFlags() {
+    return flags;
+  }
 
-	/**
-	 * Set flags
-	 *
-	 * @param flags
-	 */
-	public void setFlags(ForwardingFlags flags) {
-		this.flags = flags;
-	}
+  /**
+   * Set flags
+   *
+   * @param flags
+   */
+  public void setFlags(ForwardingFlags flags) {
+    this.flags = flags;
+  }
 
-	/**
-	 * Get expiration period
-	 *
-	 * @return
-	 */
-	public double getExpirationPeriod() {
-		return expirationPeriod;
-	}
+  /**
+   * Get expiration period
+   *
+   * @return
+   */
+  public double getExpirationPeriod() {
+    return expirationPeriod;
+  }
 
-	/**
-	 * Set expiration period
-	 *
-	 * @param expirationPeriod
-	 */
-	public void setExpirationPeriod(double expirationPeriod) {
-		this.expirationPeriod = 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;
+  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/src/main/java/com/intel/jndn/management/types/StatusDataset.java b/src/main/java/com/intel/jndn/management/types/StatusDataset.java
index 0117ee7..d20a717 100644
--- a/src/main/java/com/intel/jndn/management/types/StatusDataset.java
+++ b/src/main/java/com/intel/jndn/management/types/StatusDataset.java
@@ -24,27 +24,27 @@
  */
 public class StatusDataset {
 
-	/**
-	 * Decode multiple status entries as part of a StatusDataset, see
-	 * http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
-	 *
-	 * @param <T>
-	 * @param statusDataset
-	 * @param type
-	 * @return
-	 * @throws EncodingException
-	 * @throws InstantiationException
-	 * @throws IllegalAccessException
-	 */
-	public static final <T extends Decodable> List<T> wireDecode(Blob statusDataset, Class<T> type) throws EncodingException, InstantiationException, IllegalAccessException {
-		List<T> entries = new ArrayList<>();
-		int endOffset = statusDataset.size();
-		TlvDecoder decoder = new TlvDecoder(statusDataset.buf());
-		while (decoder.getOffset() < endOffset) {
-			T entry = type.newInstance();
-			entry.wireDecode(decoder);
-			entries.add(entry);
-		}
-		return entries;
-	}
+  /**
+   * Decode multiple status entries as part of a StatusDataset, see
+   * http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+   *
+   * @param <T>
+   * @param statusDataset
+   * @param type
+   * @return
+   * @throws EncodingException
+   * @throws InstantiationException
+   * @throws IllegalAccessException
+   */
+  public static final <T extends Decodable> List<T> wireDecode(Blob statusDataset, Class<T> type) throws EncodingException, InstantiationException, IllegalAccessException {
+    List<T> entries = new ArrayList<>();
+    int endOffset = statusDataset.size();
+    TlvDecoder decoder = new TlvDecoder(statusDataset.buf());
+    while (decoder.getOffset() < endOffset) {
+      T entry = type.newInstance();
+      entry.wireDecode(decoder);
+      entries.add(entry);
+    }
+    return entries;
+  }
 }
diff --git a/src/test/java/com/intel/jndn/management/ControlResponseTest.java b/src/test/java/com/intel/jndn/management/ControlResponseTest.java
index 5d026e0..d21c3e0 100644
--- a/src/test/java/com/intel/jndn/management/ControlResponseTest.java
+++ b/src/test/java/com/intel/jndn/management/ControlResponseTest.java
@@ -22,31 +22,31 @@
  */
 public class ControlResponseTest {
 
-	/**
-	 * Test encoding/decoding
-	 *
-	 * @throws java.lang.Exception
-	 */
-	@Test
-	public void testEncodeDecode() throws Exception {
-		ControlParameters parameters = new ControlParameters();
-		parameters.setFaceId(3);
-		ControlResponse response = new ControlResponse();
-		response.setStatusCode(404);
-		response.setStatusText("Not Found");
-		response.getBody().add(parameters);
+  /**
+   * Test encoding/decoding
+   *
+   * @throws java.lang.Exception
+   */
+  @Test
+  public void testEncodeDecode() throws Exception {
+    ControlParameters parameters = new ControlParameters();
+    parameters.setFaceId(3);
+    ControlResponse response = new ControlResponse();
+    response.setStatusCode(404);
+    response.setStatusText("Not Found");
+    response.getBody().add(parameters);
 
-		// encode
-		Blob encoded = response.wireEncode();
+    // encode
+    Blob encoded = response.wireEncode();
 
-		// decode
-		ControlResponse decoded = new ControlResponse();
-		decoded.wireDecode(encoded.buf());
+    // decode
+    ControlResponse decoded = new ControlResponse();
+    decoded.wireDecode(encoded.buf());
 
-		// test
-		Assert.assertEquals(response.getStatusCode(), decoded.getStatusCode());
-		Assert.assertEquals(response.getStatusText(), decoded.getStatusText());
-		Assert.assertEquals(response.getBody().size(), decoded.getBody().size());
-		Assert.assertEquals(response.getBody().get(0).getFaceId(), decoded.getBody().get(0).getFaceId());
-	}
+    // test
+    Assert.assertEquals(response.getStatusCode(), decoded.getStatusCode());
+    Assert.assertEquals(response.getStatusText(), decoded.getStatusText());
+    Assert.assertEquals(response.getBody().size(), decoded.getBody().size());
+    Assert.assertEquals(response.getBody().get(0).getFaceId(), decoded.getBody().get(0).getFaceId());
+  }
 }
diff --git a/src/test/java/com/intel/jndn/management/FaceStatusTest.java b/src/test/java/com/intel/jndn/management/FaceStatusTest.java
index f0d3eaf..e5fbab7 100644
--- a/src/test/java/com/intel/jndn/management/FaceStatusTest.java
+++ b/src/test/java/com/intel/jndn/management/FaceStatusTest.java
@@ -34,127 +34,127 @@
  */
 public class FaceStatusTest {
 
-	private static final Logger logger = LogManager.getLogger();
+  private static final Logger logger = LogManager.getLogger();
 
-	/**
-	 * Test encoding/decoding
-	 *
-	 * @throws java.lang.Exception
-	 */
-	@Test
-	public void testEncodeDecode() throws Exception {
-		FaceStatus status = new FaceStatus();
-		status.setFaceId(42);
-		status.setUri("...");
-		status.setLocalUri("...");
+  /**
+   * Test encoding/decoding
+   *
+   * @throws java.lang.Exception
+   */
+  @Test
+  public void testEncodeDecode() throws Exception {
+    FaceStatus status = new FaceStatus();
+    status.setFaceId(42);
+    status.setUri("...");
+    status.setLocalUri("...");
 
-		// encode
-		Blob encoded = status.wireEncode();
+    // encode
+    Blob encoded = status.wireEncode();
 
-		// decode
-		FaceStatus decoded = new FaceStatus();
-		decoded.wireDecode(encoded.buf());
+    // decode
+    FaceStatus decoded = new FaceStatus();
+    decoded.wireDecode(encoded.buf());
 
-		// test
-		Assert.assertEquals(status.getFaceId(), decoded.getFaceId());
-		Assert.assertEquals(status.getUri(), decoded.getUri());
-		Assert.assertEquals(status.getLocalUri(), decoded.getLocalUri());
-		Assert.assertEquals(status.getExpirationPeriod(), decoded.getExpirationPeriod());
-		Assert.assertEquals(status.getFaceScope(), decoded.getFaceScope());
-		Assert.assertEquals(status.getFacePersistency(), decoded.getFacePersistency());
-		Assert.assertEquals(status.getLinkType(), decoded.getLinkType());
-		Assert.assertEquals(status.getInBytes(), decoded.getInBytes());
-		Assert.assertEquals(status.getOutBytes(), decoded.getOutBytes());
-	}
+    // test
+    Assert.assertEquals(status.getFaceId(), decoded.getFaceId());
+    Assert.assertEquals(status.getUri(), decoded.getUri());
+    Assert.assertEquals(status.getLocalUri(), decoded.getLocalUri());
+    Assert.assertEquals(status.getExpirationPeriod(), decoded.getExpirationPeriod());
+    Assert.assertEquals(status.getFaceScope(), decoded.getFaceScope());
+    Assert.assertEquals(status.getFacePersistency(), decoded.getFacePersistency());
+    Assert.assertEquals(status.getLinkType(), decoded.getLinkType());
+    Assert.assertEquals(status.getInBytes(), decoded.getInBytes());
+    Assert.assertEquals(status.getOutBytes(), decoded.getOutBytes());
+  }
 
-	/**
-	 * Test of decode method, of class FaceStatus.
-	 *
-	 * @throws java.lang.Exception
-	 */
-	@Test
-	public void testDecodeFakeData() throws Exception {
-		Data data = getFaceData(true);
-		List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
-		assertTrue(results.size() > 4);
-		for (FaceStatus f : results) {
-			// the first face (face 1) should always be the internal face
-			if (f.getFaceId() == 1) {
-				assertEquals("internal://", f.getUri());
-				assertEquals("internal://", f.getLocalUri());
-			}
-		}
-	}
+  /**
+   * Test of decode method, of class FaceStatus.
+   *
+   * @throws java.lang.Exception
+   */
+  @Test
+  public void testDecodeFakeData() throws Exception {
+    Data data = getFaceData(true);
+    List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
+    assertTrue(results.size() > 4);
+    for (FaceStatus f : results) {
+      // the first face (face 1) should always be the internal face
+      if (f.getFaceId() == 1) {
+        assertEquals("internal://", f.getUri());
+        assertEquals("internal://", f.getLocalUri());
+      }
+    }
+  }
 
-	/**
-	 * Integration test to run on actual system
-	 *
-	 * @param args
-	 * @throws EncodingException
-	 */
-	public static void main(String[] args) throws Exception {
-		Data data = getFaceData(false);
-		List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
-		assertTrue(results.size() > 4);
-		for (FaceStatus f : results) {
-			// the first face (face 1) should always be the internal face
-			if (f.getFaceId() == 1) {
-				assertEquals("internal://", f.getUri());
-				assertEquals("internal://", f.getLocalUri());
-			}
-		}
-	}
+  /**
+   * Integration test to run on actual system
+   *
+   * @param args
+   * @throws EncodingException
+   */
+  public static void main(String[] args) throws Exception {
+    Data data = getFaceData(false);
+    List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
+    assertTrue(results.size() > 4);
+    for (FaceStatus f : results) {
+      // the first face (face 1) should always be the internal face
+      if (f.getFaceId() == 1) {
+        assertEquals("internal://", f.getUri());
+        assertEquals("internal://", f.getLocalUri());
+      }
+    }
+  }
 
-	/**
-	 * Retrieve a TLV encoded representation of the face list data
-	 *
-	 * @param usePreComputedData to avoid errors when local NFD is not present
-	 * @return
-	 */
-	private static Data getFaceData(boolean usePreComputedData) {
-		// use pre-computed data to avoid errors when local NFD is not present
-		if (usePreComputedData) {
-			Data data = new Data();
-			data.setContent(new Blob(hexStringToByteArray(DATA)));
-			return data;
-		} // alternately, query the actual localhost for current data
-		else {
-			Face forwarder = new Face("localhost");
+  /**
+   * Retrieve a TLV encoded representation of the face list data
+   *
+   * @param usePreComputedData to avoid errors when local NFD is not present
+   * @return
+   */
+  private static Data getFaceData(boolean usePreComputedData) {
+    // use pre-computed data to avoid errors when local NFD is not present
+    if (usePreComputedData) {
+      Data data = new Data();
+      data.setContent(new Blob(hexStringToByteArray(DATA)));
+      return data;
+    } // alternately, query the actual localhost for current data
+    else {
+      Face forwarder = new Face("localhost");
 
-			// build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
-			Interest interest = new Interest(new Name("/localhost/nfd/faces/list"));
-			interest.setMustBeFresh(true);
-			interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
-			interest.setInterestLifetimeMilliseconds(2000.0);
+      // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+      Interest interest = new Interest(new Name("/localhost/nfd/faces/list"));
+      interest.setMustBeFresh(true);
+      interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
+      interest.setInterestLifetimeMilliseconds(2000.0);
 
-			// send packet
-			Data data = Client.getDefault().getSync(forwarder, interest);
-			String hex = data.getContent().toHex();
-			logger.info("Hex dump of face list: " + hex);
-			return data;
-		}
-	}
+      // send packet
+      Data data = Client.getDefault().getSync(forwarder, interest);
+      String hex = data.getContent().toHex();
+      logger.info("Hex dump of face list: " + hex);
+      return data;
+    }
+  }
 
-	/**
-	 * Pre-computed face list from a vanilla NFD running on Ubuntu 14.04
-	 */
-	private static final String DATA = "803a690101720b696e7465726e616c3a2f2f810b696e7465726e616c3a2f2f840101850100860100900100910201429202063993010094010095010080406901fe720f636f6e74656e7473746f72653a2f2f810f636f6e74656e7473746f72653a2f2f84010185010086010090010091010092010093010094010095010080306901ff72076e756c6c3a2f2f81076e756c6c3a2f2f8401018501008601009001009101009201009301009401009501008053690201007219756470343a2f2f3232342e302e32332e3137303a35363336338117756470343a2f2f31302e35342e31322e373a35363336338401008501008601009001009101009201009301009401009501008056690201017219756470343a2f2f3232342e302e32332e3137303a3536333633811a756470343a2f2f3139322e3136382e35302e35373a3536333633840100850100860100900100910100920100930100940100950100804869020102721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810a6465763a2f2f65746830840100850100860100900100910100920100930100940100950100804969020103721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810b6465763a2f2f776c616e30840100850100860100900100910100920100930100940100950100804669020104720766643a2f2f32328114756e69783a2f2f2f72756e2f6e66642e736f636b840101850101860100900206349101019201019302012e940400014079950400041903804e690201197216746370343a2f2f3132372e302e302e313a35363336358115746370343a2f2f3132372e302e302e313a36333633840101850101860100900101910100920100930100940132950100";
+  /**
+   * Pre-computed face list from a vanilla NFD running on Ubuntu 14.04
+   */
+  private static final String DATA = "803a690101720b696e7465726e616c3a2f2f810b696e7465726e616c3a2f2f840101850100860100900100910201429202063993010094010095010080406901fe720f636f6e74656e7473746f72653a2f2f810f636f6e74656e7473746f72653a2f2f84010185010086010090010091010092010093010094010095010080306901ff72076e756c6c3a2f2f81076e756c6c3a2f2f8401018501008601009001009101009201009301009401009501008053690201007219756470343a2f2f3232342e302e32332e3137303a35363336338117756470343a2f2f31302e35342e31322e373a35363336338401008501008601009001009101009201009301009401009501008056690201017219756470343a2f2f3232342e302e32332e3137303a3536333633811a756470343a2f2f3139322e3136382e35302e35373a3536333633840100850100860100900100910100920100930100940100950100804869020102721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810a6465763a2f2f65746830840100850100860100900100910100920100930100940100950100804969020103721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810b6465763a2f2f776c616e30840100850100860100900100910100920100930100940100950100804669020104720766643a2f2f32328114756e69783a2f2f2f72756e2f6e66642e736f636b840101850101860100900206349101019201019302012e940400014079950400041903804e690201197216746370343a2f2f3132372e302e302e313a35363336358115746370343a2f2f3132372e302e302e313a36333633840101850101860100900101910100920100930100940132950100";
 
-	/**
-	 * Convert hex string to bytes; special thanks to
-	 * http://stackoverflow.com/questions/140131
-	 *
-	 * @param s
-	 * @return
-	 */
-	private static byte[] hexStringToByteArray(String s) {
-		int len = s.length();
-		byte[] data = new byte[len / 2];
-		for (int i = 0; i < len; i += 2) {
-			data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
-					+ Character.digit(s.charAt(i + 1), 16));
-		}
-		return data;
-	}
+  /**
+   * Convert hex string to bytes; special thanks to
+   * http://stackoverflow.com/questions/140131
+   *
+   * @param s
+   * @return
+   */
+  private static byte[] hexStringToByteArray(String s) {
+    int len = s.length();
+    byte[] data = new byte[len / 2];
+    for (int i = 0; i < len; i += 2) {
+      data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+              + Character.digit(s.charAt(i + 1), 16));
+    }
+    return data;
+  }
 
 }
diff --git a/src/test/java/com/intel/jndn/management/FibEntryTest.java b/src/test/java/com/intel/jndn/management/FibEntryTest.java
index 85ac273..e198e7d 100644
--- a/src/test/java/com/intel/jndn/management/FibEntryTest.java
+++ b/src/test/java/com/intel/jndn/management/FibEntryTest.java
@@ -32,54 +32,54 @@
  */
 public class FibEntryTest {
 
-	/**
-	 * Test encoding/decoding
-	 *
-	 * @throws java.lang.Exception
-	 */
-	@Test
-	public void testEncodeDecode() throws Exception {
-		NextHopRecord nextHopRecord = new NextHopRecord();
-		nextHopRecord.setFaceId(42);
-		nextHopRecord.setCost(100);
-		FibEntry entry = new FibEntry();
-		entry.setName(new Name("/fib/entry/test"));
-		entry.getRecords().add(nextHopRecord);
+  /**
+   * Test encoding/decoding
+   *
+   * @throws java.lang.Exception
+   */
+  @Test
+  public void testEncodeDecode() throws Exception {
+    NextHopRecord nextHopRecord = new NextHopRecord();
+    nextHopRecord.setFaceId(42);
+    nextHopRecord.setCost(100);
+    FibEntry entry = new FibEntry();
+    entry.setName(new Name("/fib/entry/test"));
+    entry.getRecords().add(nextHopRecord);
 
-		// encode
-		Blob encoded = entry.wireEncode();
+    // encode
+    Blob encoded = entry.wireEncode();
 
-		// decode
-		FibEntry decoded = new FibEntry();
-		decoded.wireDecode(encoded.buf());
+    // decode
+    FibEntry decoded = new FibEntry();
+    decoded.wireDecode(encoded.buf());
 
-		// test
-		Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
-		Assert.assertEquals(entry.getRecords().get(0).getFaceId(), decoded.getRecords().get(0).getFaceId());
-		Assert.assertEquals(entry.getRecords().get(0).getCost(), decoded.getRecords().get(0).getCost());
-	}
+    // test
+    Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
+    Assert.assertEquals(entry.getRecords().get(0).getFaceId(), decoded.getRecords().get(0).getFaceId());
+    Assert.assertEquals(entry.getRecords().get(0).getCost(), decoded.getRecords().get(0).getCost());
+  }
 
-	/**
-	 * Integration test to run on actual system
-	 *
-	 * @param args
-	 * @throws EncodingException
-	 */
-	public static void main(String[] args) throws Exception {
-		Face forwarder = new Face("localhost");
+  /**
+   * Integration test to run on actual system
+   *
+   * @param args
+   * @throws EncodingException
+   */
+  public static void main(String[] args) throws Exception {
+    Face forwarder = new Face("localhost");
 
-		// build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
-		Interest interest = new Interest(new Name("/localhost/nfd/fib/list"));
-		interest.setMustBeFresh(true);
-		interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
-		interest.setInterestLifetimeMilliseconds(2000.0);
+    // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+    Interest interest = new Interest(new Name("/localhost/nfd/fib/list"));
+    interest.setMustBeFresh(true);
+    interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
+    interest.setInterestLifetimeMilliseconds(2000.0);
 
-		// send packet
-		Data data = Client.getDefault().getSync(forwarder, interest);
+    // send packet
+    Data data = Client.getDefault().getSync(forwarder, interest);
 
-		// decode results
-		List<FibEntry> results = StatusDataset.wireDecode(data.getContent(), FibEntry.class);
-		assertTrue(results.size() > 0);
-		assertEquals("/localhost/nfd", results.get(0).getName().toUri());
-	}
+    // decode results
+    List<FibEntry> results = StatusDataset.wireDecode(data.getContent(), FibEntry.class);
+    assertTrue(results.size() > 0);
+    assertEquals("/localhost/nfd", results.get(0).getName().toUri());
+  }
 }
diff --git a/src/test/java/com/intel/jndn/management/RibEntryTest.java b/src/test/java/com/intel/jndn/management/RibEntryTest.java
index 96dd70b..a0ba770 100644
--- a/src/test/java/com/intel/jndn/management/RibEntryTest.java
+++ b/src/test/java/com/intel/jndn/management/RibEntryTest.java
@@ -32,56 +32,56 @@
  */
 public class RibEntryTest {
 
-	/**
-	 * Test encoding/decoding
-	 *
-	 * @throws java.lang.Exception
-	 */
-	@Test
-	public void testEncodeDecode() throws Exception {
-		Route route = new Route();
-		route.setFaceId(42);
-		route.setCost(100);
-		route.setOrigin(0);
-		RibEntry entry = new RibEntry();
-		entry.setName(new Name("/rib/entry/test"));
-		entry.getRoutes().add(route);
+  /**
+   * Test encoding/decoding
+   *
+   * @throws java.lang.Exception
+   */
+  @Test
+  public void testEncodeDecode() throws Exception {
+    Route route = new Route();
+    route.setFaceId(42);
+    route.setCost(100);
+    route.setOrigin(0);
+    RibEntry entry = new RibEntry();
+    entry.setName(new Name("/rib/entry/test"));
+    entry.getRoutes().add(route);
 
-		// encode
-		Blob encoded = entry.wireEncode();
+    // encode
+    Blob encoded = entry.wireEncode();
 
-		// decode
-		RibEntry decoded = new RibEntry();
-		decoded.wireDecode(encoded.buf());
+    // decode
+    RibEntry decoded = new RibEntry();
+    decoded.wireDecode(encoded.buf());
 
-		// test
-		Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
-		Assert.assertEquals(entry.getRoutes().get(0).getFaceId(), decoded.getRoutes().get(0).getFaceId());
-		Assert.assertEquals(entry.getRoutes().get(0).getCost(), decoded.getRoutes().get(0).getCost());
-		Assert.assertEquals(entry.getRoutes().get(0).getOrigin(), decoded.getRoutes().get(0).getOrigin());
-	}
+    // test
+    Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
+    Assert.assertEquals(entry.getRoutes().get(0).getFaceId(), decoded.getRoutes().get(0).getFaceId());
+    Assert.assertEquals(entry.getRoutes().get(0).getCost(), decoded.getRoutes().get(0).getCost());
+    Assert.assertEquals(entry.getRoutes().get(0).getOrigin(), decoded.getRoutes().get(0).getOrigin());
+  }
 
-	/**
-	 * Integration test to run on actual system
-	 *
-	 * @param args
-	 * @throws EncodingException
-	 */
-	public static void main(String[] args) throws Exception {
-		Face forwarder = new Face("localhost");
+  /**
+   * Integration test to run on actual system
+   *
+   * @param args
+   * @throws EncodingException
+   */
+  public static void main(String[] args) throws Exception {
+    Face forwarder = new Face("localhost");
 
-		// build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
-		Interest interest = new Interest(new Name("/localhost/nfd/rib/list"));
-		interest.setMustBeFresh(true);
-		interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
-		interest.setInterestLifetimeMilliseconds(2000.0);
+    // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+    Interest interest = new Interest(new Name("/localhost/nfd/rib/list"));
+    interest.setMustBeFresh(true);
+    interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
+    interest.setInterestLifetimeMilliseconds(2000.0);
 
-		// send packet
-		Data data = Client.getDefault().getSync(forwarder, interest);
+    // send packet
+    Data data = Client.getDefault().getSync(forwarder, interest);
 
-		// decode results
-		List<RibEntry> results = StatusDataset.wireDecode(data.getContent(), RibEntry.class);
-		assertTrue(results.size() > 0);
-		assertEquals("/localhost/nfd", results.get(0).getName().toUri());
-	}
+    // decode results
+    List<RibEntry> results = StatusDataset.wireDecode(data.getContent(), RibEntry.class);
+    assertTrue(results.size() > 0);
+    assertEquals("/localhost/nfd", results.get(0).getName().toUri());
+  }
 }
