diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/IPathCalcRuntimeService.java b/src/main/java/net/onrc/onos/core/intent/runtime/IPathCalcRuntimeService.java
index b81dbab..802f244 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/IPathCalcRuntimeService.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/IPathCalcRuntimeService.java
@@ -8,11 +8,11 @@
 import net.onrc.onos.core.intent.IntentOperationList;
 
 /**
- * @author Toshio Koide (t-koide@onlab.us)
+ * Interface class used by PathCalcRuntimeModule class to operate intents.
  */
 public interface IPathCalcRuntimeService extends IFloodlightService {
     /**
-     * Add Application Intents.
+     * Adds Application Intents.
      *
      * @param appId the Application ID to use.
      * @param appIntents the Application Intents to add.
@@ -23,7 +23,7 @@
                 Collection<ApplicationIntent> appIntents);
 
     /**
-     * Remove Application Intents.
+     * Removes Application Intents.
      *
      * @param appId the Application ID to use.
      * @param intentIds the Application Intent IDs to remove.
@@ -33,18 +33,50 @@
                                             Collection<String> intentIds);
 
     /**
-     * Remove all Application Intents.
+     * Removes all Application Intents.
      *
      * @param appId the Application ID to use.
      * @return true on success, otherwise false.
      */
     public boolean removeAllApplicationIntents(final String appId);
 
+    /**
+     * Executes Application-level Intent operations.
+     * <p>
+     * IntentOperationList accepts ADD and REMOVE operations at the same time
+     * in order to update intents in one shot. It converts application-level
+     * intent operations into path-level intent operations, and send them to
+     * PlanCalcModule.
+     *
+     * @param list a list of intent operations
+     * @return the converted path-level intent operations
+     */
     public IntentOperationList executeIntentOperations(IntentOperationList list);
 
+    /**
+     * Retrieves application-level intents.
+     * <p>
+     * It returns IntentMap object. This object has listener to listen the
+     * additions, the removals and the status changes of intents.
+     *
+     * @return application-level intents.
+     */
     public IntentMap getHighLevelIntents();
 
+    /**
+     * Retrieves path-level intents.
+     * <p>
+     * It returns IntentMap object. This object has listener to listen the
+     * additions, the removals and the status changes of intents.
+     *
+     * @return path-level intents.
+     */
     public IntentMap getPathIntents();
 
+    /**
+     * Purges invalid intents.
+     * <p>
+     * It removes all uninstalled or failed application/path level intents.
+     */
     public void purgeIntents();
 }
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/IntentStateList.java b/src/main/java/net/onrc/onos/core/intent/runtime/IntentStateList.java
index 2b4946f..6103c64 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/IntentStateList.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/IntentStateList.java
@@ -7,23 +7,46 @@
 import java.util.Set;
 
 import net.onrc.onos.core.intent.Intent.IntentState;
+
+/**
+ * Used by PathCalcRuntimeModule and PlanInstallModule
+ * to notify path intents' state changes.
+ */
 public class IntentStateList {
     protected Map<String, IntentState> intentMap;
     public Set<Long> domainSwitchDpids;
 
+    /**
+     * Constructor to make new IntentStateList.
+     */
     public IntentStateList() {
         intentMap = new HashMap<String, IntentState>();
         domainSwitchDpids = new HashSet<Long>();
     }
 
+    /**
+     * Adds or modifies intent's state.
+     *
+     * @param id an intent ID for the state.
+     * @param state a state for the intent.
+     * @return the previous state, or null if there was no intents.
+     */
     public IntentState put(String id, IntentState state) {
         return intentMap.put(id, state);
     }
 
+    /**
+     * Returns a set of view of the intent states.
+     *
+     * @return a set of intent IDs and intent states.
+     */
     public Set<Entry<String, IntentState>> entrySet() {
         return intentMap.entrySet();
     }
 
+    /**
+     * Removes all of intent states from this object.
+     */
     public void clear() {
         intentMap.clear();
     }
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntime.java b/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntime.java
index e1b95e2..03e23c5 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntime.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntime.java
@@ -24,18 +24,25 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * @author Toshio Koide (t-koide@onlab.us)
+ * The runtime used by PathCalcRuntimeModule class.
+ * <p>
+ * It calculates shortest-path and constrained-shortest-path.
  */
 public class PathCalcRuntime implements IFloodlightService {
     private Topology topology;
     private static final Logger log = LoggerFactory.getLogger(PathCalcRuntime.class);
 
+    /**
+     * Constructor.
+     *
+     * @param topology a topology object to use for the path calculation.
+     */
     public PathCalcRuntime(Topology topology) {
         this.topology = topology;
     }
 
     /**
-     * calculate shortest-path and constrained-shortest-path intents into low-level path intents.
+     * Calculates shortest-path and constrained-shortest-path intents into low-level path intents.
      *
      * @param intentOpList IntentOperationList having instances of ShortestPathIntent/ConstrainedShortestPathIntent
      * @param pathIntents  a set of current low-level intents
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModule.java b/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModule.java
index 2f820a0..bfbaa30 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModule.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModule.java
@@ -50,12 +50,21 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * @author Toshio Koide (t-koide@onlab.us)
+ * The PathCalcRuntimeModule contains the PathCalcRuntime and PersistIntent.
+ * <p>
+ * It is responsible for converting operations for application level intents
+ * into operations for path level intents and send the converted operations
+ * to PlanCalcRuntimeModule in order to calculate flow entries and install them.
  */
 public class PathCalcRuntimeModule implements IFloodlightModule,
                                     IPathCalcRuntimeService,
                                     ITopologyListener,
                                     IEventChannelListener<Long, IntentStateList> {
+
+    /**
+     * Logging object for performance measurement.
+     * TODO: merge this into measurement framework
+     */
     static class PerfLog {
         private String step;
         private long time;
@@ -70,6 +79,10 @@
         }
     }
 
+    /**
+     * Formatted logger for performance measurement.
+     * TODO: merge this into measurement framework
+     */
     static class PerfLogger {
         private LinkedList<PerfLog> logData = new LinkedList<>();
 
@@ -198,6 +211,13 @@
     // private methods
     // ================================================================================
 
+    /**
+     * Creates operations (IntentOperationList) for Application-level
+     * intents that should be rerouted because of topology change,
+     * and execute the created operations.
+     *
+     * @param oldPaths a list of invalid path intents (which should be rerouted)
+     */
     private void reroutePaths(Collection<Intent> oldPaths) {
         if (oldPaths == null || oldPaths.isEmpty()) {
             return;
@@ -227,11 +247,86 @@
         executeIntentOperations(reroutingOperation);
     }
 
+    /**
+     * Checks whether the entire path's flow entries are installed or not.
+     *
+     * @param pathIntent : The pathIntent to be checked
+     * @param installedDpids : The dpids installed on one ONOS instance
+     * @return The result of whether a pathIntent has been installed or not.
+     */
+    private boolean isFlowInstalled(PathIntent pathIntent, Set<Long> installedDpids) {
+        String pathIntentId = pathIntent.getId();
+
+        if (intentInstalledMap.containsKey(pathIntentId)) {
+            if (!installedDpids.isEmpty()) {
+                intentInstalledMap.get(pathIntentId).addAll(installedDpids);
+            }
+        } else {
+            // This is the creation of an entry.
+            intentInstalledMap.put(pathIntentId, installedDpids);
+        }
+
+        Set<Long> allSwitchesForPath = new HashSet<Long>();
+        ShortestPathIntent spfIntent = (ShortestPathIntent) pathIntent.getParentIntent();
+
+        for (LinkEvent linkEvent : pathIntent.getPath()) {
+            long sw = linkEvent.getSrc().getDpid();
+            allSwitchesForPath.add(sw);
+        }
+        allSwitchesForPath.add(spfIntent.getDstSwitchDpid());
+
+        if (log.isDebugEnabled()) {
+            log.debug("checking flow installation. ID:{}, dpids:{}, installed:{}",
+                    pathIntentId,
+                    allSwitchesForPath,
+                    intentInstalledMap.get(pathIntentId));
+        }
+
+        if (allSwitchesForPath.equals(intentInstalledMap.get(pathIntentId))) {
+            intentInstalledMap.remove(pathIntentId);
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Enumerates switch dpids along the specified path and inside the specified domain.
+     *
+     * @param pathIntent the path for enumeration
+     * @param domainSwitchDpids a set of the domain switch dpids
+     * @return a set of switch dpids along the specified path and inside the specified domain
+     */
+    private Set<Long> calcInstalledDpids(PathIntent pathIntent, Set<Long> domainSwitchDpids) {
+        Set<Long> allSwitchesForPath = new HashSet<Long>();
+        ShortestPathIntent spfIntent = (ShortestPathIntent) pathIntent.getParentIntent();
+
+        for (LinkEvent linkEvent : pathIntent.getPath()) {
+            long sw = linkEvent.getSrc().getDpid();
+
+            if (domainSwitchDpids.contains(sw)) {
+                allSwitchesForPath.add(sw);
+            }
+        }
+
+        if (domainSwitchDpids.contains(spfIntent.getDstSwitchDpid())) {
+            allSwitchesForPath.add(spfIntent.getDstSwitchDpid());
+        }
+
+        if (log.isTraceEnabled()) {
+            log.trace("All switches for a path {}, domain switch dpids {}", allSwitchesForPath, domainSwitchDpids);
+        }
+
+        return allSwitchesForPath;
+    }
 
     // ================================================================================
     // IFloodlightModule implementations
     // ================================================================================
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleServices() {
         Collection<Class<? extends IFloodlightService>> l = new ArrayList<>(1);
@@ -239,6 +334,9 @@
         return l;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
         Map<Class<? extends IFloodlightService>, IFloodlightService> m = new HashMap<>();
@@ -246,6 +344,9 @@
         return m;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
         Collection<Class<? extends IFloodlightService>> l = new ArrayList<>(2);
@@ -255,6 +356,9 @@
         return l;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void init(FloodlightModuleContext context) throws FloodlightModuleException {
         datagridService = context.getServiceImpl(IDatagridService.class);
@@ -263,6 +367,9 @@
         restApi = context.getServiceImpl(IRestApiService.class);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void startUp(FloodlightModuleContext context) {
         highLevelIntents = new IntentMap();
@@ -282,11 +389,7 @@
     // ======================================================================
 
     /**
-     * Add Application Intents.
-     *
-     * @param appId the Application ID to use.
-     * @param appIntents the Application Intents to add.
-     * @return true on success, otherwise false.
+     * {@inheritDoc}
      */
     @Override
     public boolean addApplicationIntents(
@@ -349,11 +452,7 @@
     }
 
     /**
-     * Remove Application Intents.
-     *
-     * @param appId the Application ID to use.
-     * @param intentIds the Application Intent IDs to remove.
-     * @return true on success, otherwise false.
+     * {@inheritDoc}
      */
     @Override
     public boolean removeApplicationIntents(final String appId,
@@ -395,10 +494,7 @@
     }
 
     /**
-     * Remove all Application Intents.
-     *
-     * @param appId the Application ID to use.
-     * @return true on success, otherwise false.
+     * {@inheritDoc}
      */
     @Override
     public boolean removeAllApplicationIntents(final String appId) {
@@ -434,6 +530,9 @@
         return true;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public IntentOperationList executeIntentOperations(IntentOperationList list) {
 
@@ -513,16 +612,25 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public IntentMap getHighLevelIntents() {
         return highLevelIntents;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public IntentMap getPathIntents() {
         return pathIntents;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void purgeIntents() {
         highLevelIntents.purge();
@@ -534,6 +642,9 @@
     // ================================================================================
 
     // CHECKSTYLE:OFF suppress warning about too many parameters
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void topologyEvents(Collection<SwitchEvent> addedSwitchEvents,
                                    Collection<SwitchEvent> removedSwitchEvents,
@@ -609,16 +720,25 @@
     // IEventChannelListener implementations
     // ================================================================================
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void entryAdded(IntentStateList value) {
         entryUpdated(value);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void entryRemoved(IntentStateList value) {
         // do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @SuppressWarnings("fallthrough")
     @Override
     public void entryUpdated(IntentStateList value) {
@@ -712,70 +832,4 @@
         }
         executeIntentOperations(opList);
     }
-
-    /***
-     * This function is to check whether the entire path's flow entries are installed or not.
-     *
-     * @param pathIntent : The pathIntent to be checked
-     * @param installedDpids : The dpids installed on one ONOS instance
-     * @return The result of whether a pathIntent has been installed or not.
-     */
-    private boolean isFlowInstalled(PathIntent pathIntent, Set<Long> installedDpids) {
-        String pathIntentId = pathIntent.getId();
-
-        if (intentInstalledMap.containsKey(pathIntentId)) {
-            if (!installedDpids.isEmpty()) {
-                intentInstalledMap.get(pathIntentId).addAll(installedDpids);
-            }
-        } else {
-            // This is the creation of an entry.
-            intentInstalledMap.put(pathIntentId, installedDpids);
-        }
-
-        Set<Long> allSwitchesForPath = new HashSet<Long>();
-        ShortestPathIntent spfIntent = (ShortestPathIntent) pathIntent.getParentIntent();
-
-        for (LinkEvent linkEvent : pathIntent.getPath()) {
-            long sw = linkEvent.getSrc().getDpid();
-            allSwitchesForPath.add(sw);
-        }
-        allSwitchesForPath.add(spfIntent.getDstSwitchDpid());
-
-        if (log.isDebugEnabled()) {
-            log.debug("checking flow installation. ID:{}, dpids:{}, installed:{}",
-                    pathIntentId,
-                    allSwitchesForPath,
-                    intentInstalledMap.get(pathIntentId));
-        }
-
-        if (allSwitchesForPath.equals(intentInstalledMap.get(pathIntentId))) {
-            intentInstalledMap.remove(pathIntentId);
-            return true;
-        }
-
-        return false;
-    }
-
-    private Set<Long> calcInstalledDpids(PathIntent pathIntent, Set<Long> domainSwitchDpids) {
-        Set<Long> allSwitchesForPath = new HashSet<Long>();
-        ShortestPathIntent spfIntent = (ShortestPathIntent) pathIntent.getParentIntent();
-
-        for (LinkEvent linkEvent : pathIntent.getPath()) {
-            long sw = linkEvent.getSrc().getDpid();
-
-            if (domainSwitchDpids.contains(sw)) {
-                allSwitchesForPath.add(sw);
-            }
-        }
-
-        if (domainSwitchDpids.contains(spfIntent.getDstSwitchDpid())) {
-            allSwitchesForPath.add(spfIntent.getDstSwitchDpid());
-        }
-
-        if (log.isTraceEnabled()) {
-            log.trace("All switches for a path {}, domain switch dpids {}", allSwitchesForPath, domainSwitchDpids);
-        }
-
-        return allSwitchesForPath;
-    }
 }
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/PersistIntent.java b/src/main/java/net/onrc/onos/core/intent/runtime/PersistIntent.java
index 9a9d59c..d1076ed 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/PersistIntent.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/PersistIntent.java
@@ -21,7 +21,9 @@
 import com.esotericsoftware.kryo.io.Output;
 
 /**
- * @author nickkaranatsios
+ * The module used by PathCalcRuntimeModule class.
+ * <p>
+ * It persists intent operations into persistent storage.
  */
 public class PersistIntent {
     private static final Logger log = LoggerFactory.getLogger(PersistIntent.class);
@@ -37,7 +39,11 @@
     private long rangeEnd;
     private IdBlock idBlock = null;
 
-
+    /**
+     * Constructor.
+     *
+     * @param controllerRegistry the Registry Service to use.
+     */
     public PersistIntent(final IControllerRegistryService controllerRegistry) {
         this.controllerRegistry = controllerRegistry;
         table = DataStoreClient.getClient().getTable(INTENT_JOURNAL);
@@ -47,6 +53,21 @@
         kryo = new KryoFactory(1).newKryo();
     }
 
+    private long getNextBlock() {
+        // XXX This method is not thread safe, may lose allocated IdBlock
+        idBlock = controllerRegistry.allocateUniqueIdBlock(range);
+        nextId = new AtomicLong(idBlock.getStart());
+        rangeEnd = idBlock.getEnd();
+        return nextId.get();
+    }
+
+    /**
+     * Provides the unique key for persisting.
+     * <p>
+     * This key is necessary for persistIfLeader() method.
+     *
+     * @return a key for persisting.
+     */
     public long getKey() {
         long key;
         if (idBlock == null) {
@@ -60,14 +81,13 @@
         return key;
     }
 
-    private long getNextBlock() {
-        // XXX This method is not thread safe, may lose allocated IdBlock
-        idBlock = controllerRegistry.allocateUniqueIdBlock(range);
-        nextId = new AtomicLong(idBlock.getStart());
-        rangeEnd = idBlock.getEnd();
-        return nextId.get();
-    }
-
+    /**
+     * Persist intent operations into persistent storage only if this instance was a leader.
+     *
+     * @param key a unique key
+     * @param operations intent operations
+     * @return true if succeeded, otherwise false.
+     */
     public boolean persistIfLeader(long key, IntentOperationList operations) {
         boolean leader = true;
         boolean ret = false;
