diff --git a/src/main/java/org.onosproject.xran/impl/DefaultXranStore.java b/src/main/java/org.onosproject.xran/impl/DefaultXranStore.java
index 19e50ab..9a1a259 100644
--- a/src/main/java/org.onosproject.xran/impl/DefaultXranStore.java
+++ b/src/main/java/org.onosproject.xran/impl/DefaultXranStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,7 +19,12 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Lists;
-import org.apache.felix.scr.annotations.*;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.core.IdGenerator;
@@ -45,7 +50,7 @@
 import static org.slf4j.LoggerFactory.getLogger;
 
 /**
- * Created by dimitris on 7/22/17.
+ * Default xran store.
  */
 @Component(immediate = true)
 @Service
@@ -67,6 +72,7 @@
     public void activate() {
         ApplicationId appId = coreService.getAppId(XRAN_APP_ID);
 
+        // create ue id generator
         ueIdGenerator = coreService.getIdGenerator("xran-ue-id");
 
         log.info("XRAN Default Store Started");
@@ -85,7 +91,7 @@
     }
 
     @Override
-    public List<RnibLink> getLinksByECGI(ECGI ecgi) {
+    public List<RnibLink> getlinksbyecgi(ECGI ecgi) {
         List<RnibLink> list = Lists.newArrayList();
         list.addAll(
                 linkMap.keySet()
@@ -98,9 +104,9 @@
     }
 
     @Override
-    public List<RnibLink> getLinksByCellId(String eciHex) {
+    public List<RnibLink> getlinksbycellid(String eciHex) {
         List<RnibLink> list = Lists.newArrayList();
-        EUTRANCellIdentifier eci = hexToECI(eciHex);
+        EUTRANCellIdentifier eci = hexToEci(eciHex);
 
         list.addAll(
                 linkMap.keySet()
@@ -113,7 +119,7 @@
     }
 
     @Override
-    public List<RnibLink> getLinksByUeId(long euId) {
+    public List<RnibLink> getlinksbyueid(long euId) {
         List<RnibLink> list = Lists.newArrayList();
 
         list.addAll(
@@ -128,13 +134,13 @@
 
 
     @Override
-    public RnibLink getLinkBetweenCellIdUeId(String eciHex, long euId) {
-        EUTRANCellIdentifier eci = hexToECI(eciHex);
+    public RnibLink getlinkbetweencellidueid(String eciHex, long euId) {
+        EUTRANCellIdentifier eci = hexToEci(eciHex);
 
         Optional<LinkId> first = linkMap.keySet()
                 .stream()
-                .filter(linkId -> linkId.getEcgi().getEUTRANcellIdentifier().equals(eci))
-                .filter(linkId -> linkId.getUeId().equals(euId))
+                .filter(linkId -> linkId.getEcgi().getEUTRANcellIdentifier().equals(eci) &&
+                        linkId.getUeId().equals(euId))
                 .findFirst();
 
         return first.map(linkId -> linkMap.get(linkId)).orElse(null);
@@ -147,12 +153,10 @@
                 // if we add a primary link then change the primary to non serving
                 if (link.getType().equals(RnibLink.Type.SERVING_PRIMARY)) {
                     RnibUe ue = link.getLinkId().getUe();
-                    getLinksByUeId(ue.getId())
-                            .forEach(l -> {
-                                if (l.getType().equals(RnibLink.Type.SERVING_PRIMARY)) {
-                                    l.setType(RnibLink.Type.NON_SERVING);
-                                }
-                            });
+                    getlinksbyueid(ue.getId())
+                            .stream()
+                            .filter(l -> l.getType().equals(RnibLink.Type.SERVING_PRIMARY))
+                            .forEach(l -> l.setType(RnibLink.Type.NON_SERVING));
                 }
                 linkMap.put(link.getLinkId(), link);
             }
@@ -166,13 +170,12 @@
 
     @Override
     public RnibLink getLink(ECGI ecgi, Long ueId) {
-
         LinkId linkId = LinkId.valueOf(ecgi, ueId);
         return linkMap.get(linkId);
     }
 
     @Override
-    public void modifyLinkRrmConf(RnibLink link, JsonNode rrmConf) {
+    public void modifylinkrrmconf(RnibLink link, JsonNode rrmConf) {
         link.modifyRrmParameters(rrmConf);
     }
 
@@ -185,25 +188,24 @@
     }
 
     @Override
-    public List<Object> getCellNodes() {
+    public List<Object> getcellnodes() {
         List<Object> list = Lists.newArrayList();
         list.addAll(cellMap.values());
         return list;
     }
 
     @Override
-    public List<Object> getUeNodes() {
+    public List<Object> getuenodes() {
         List<Object> list = Lists.newArrayList();
         list.addAll(ueMap.values());
         return list;
     }
 
     @Override
-    public Object getByNodeId(String nodeId) {
+    public Object getbynodeid(String nodeId) {
         try {
             return getCell(nodeId);
-        } catch (Exception e) {
-
+        } catch (Exception ignored) {
         }
         return getUe(Long.parseLong(nodeId));
     }
@@ -222,9 +224,13 @@
 
     @Override
     public RnibCell getCell(String hexeci) {
-        EUTRANCellIdentifier eci = hexToECI(hexeci);
-        Optional<ECGI> first = cellMap.keySet().stream().filter(ecgi -> ecgi.getEUTRANcellIdentifier().equals(eci)).findFirst();
-        return first.map(ecgi -> cellMap.get(ecgi)).orElse(null);
+        EUTRANCellIdentifier eci = hexToEci(hexeci);
+        Optional<ECGI> first = cellMap.keySet()
+                .stream()
+                .filter(ecgi -> ecgi.getEUTRANcellIdentifier().equals(eci))
+                .findFirst();
+        return first.map(ecgi -> cellMap.get(ecgi))
+                .orElse(null);
     }
 
     @Override
@@ -233,9 +239,11 @@
     }
 
     @Override
-    public void modifyCellRrmConf(RnibCell cell, JsonNode rrmConf) throws Exception {
-        List<RnibLink> linkList = getLinksByECGI(cell.getEcgi());
-        List<RnibUe> ueList = linkList.stream().map(link -> link.getLinkId().getUe()).collect(Collectors.toList());
+    public void modifycellrrmconf(RnibCell cell, JsonNode rrmConf) throws Exception {
+        List<RnibLink> linkList = getlinksbyecgi(cell.getEcgi());
+        List<RnibUe> ueList = linkList.stream()
+                .map(link -> link.getLinkId().getUe())
+                .collect(Collectors.toList());
 
         cell.modifyRrmConfig(rrmConf, ueList);
     }
@@ -285,7 +293,13 @@
         return ueMap.get(ueId);
     }
 
-    private EUTRANCellIdentifier hexToECI(String eciHex) {
+    /**
+     * Get from HEX string the according ECI class object.
+     *
+     * @param eciHex HEX string
+     * @return ECI object if created successfully
+     */
+    private EUTRANCellIdentifier hexToEci(String eciHex) {
         byte[] hexBinary = DatatypeConverter.parseHexBinary(eciHex);
         return new EUTRANCellIdentifier(hexBinary, 28);
     }
diff --git a/src/main/java/org.onosproject.xran/impl/DistributedXranStore.java b/src/main/java/org.onosproject.xran/impl/DistributedXranStore.java
index 0e9f3d5..6f3a5dc 100644
--- a/src/main/java/org.onosproject.xran/impl/DistributedXranStore.java
+++ b/src/main/java/org.onosproject.xran/impl/DistributedXranStore.java
@@ -1,5 +1,5 @@
 ///*
-// * Copyright 2015-present Open Networking Laboratory
+// * Copyright 2015-present Open Networking Foundation
 // *
 // * Licensed under the Apache License, Version 2.0 (the "License");
 // * you may not use this file except in compliance with the License.
@@ -149,7 +149,7 @@
 //    }
 //
 //    @Override
-//    public List<RnibLink> getLinksByCellId(long cellId) {
+//    public List<RnibLink> getlinksbycellid(long cellId) {
 //        List<RnibLink> list = Lists.newArrayList();
 //        CellId cell = CellId.valueOf(cellId);
 //        linkMap.keySet().forEach(
@@ -163,7 +163,7 @@
 //    }
 //
 //    @Override
-//    public List<RnibLink> getLinksByUeId(long euId) {
+//    public List<RnibLink> getlinksbyueid(long euId) {
 //        List<RnibLink> list = Lists.newArrayList();
 //        UeId ue = UeId.valueOf(euId);
 //        linkMap.keySet().forEach(
@@ -177,7 +177,7 @@
 //    }
 //
 //    @Override
-//    public RnibLink getLinkBetweenCellIdUeId(long cellId, long euId) {
+//    public RnibLink getlinkbetweencellidueid(long cellId, long euId) {
 //        LinkId linkId = LinkId.valueOf(cellId, euId);
 //        final Versioned<RnibLink> rnibLinkVersioned = linkMap.get(linkId);
 //        if (rnibLinkVersioned != null) {
@@ -188,7 +188,7 @@
 //
 //    @Override
 //    public boolean modifyTypeOfLink(long cellId, long euId, String type) {
-//        final RnibLink link = getLinkBetweenCellIdUeId(cellId, euId);
+//        final RnibLink link = getlinkbetweencellidueid(cellId, euId);
 //        if (link != null) {
 //            link.setType(type);
 //            return true;
@@ -198,7 +198,7 @@
 //
 //    @Override
 //    public boolean modifyTrafficPercentOfLink(long cellId, long euId, long trafficPercent) {
-//        final RnibLink link = getLinkBetweenCellIdUeId(cellId, euId);
+//        final RnibLink link = getlinkbetweencellidueid(cellId, euId);
 //        if (link != null) {
 //            link.setTrafficPercent(trafficPercent);
 //            return true;
@@ -232,21 +232,21 @@
 //    }
 //
 //    @Override
-//    public List<RnibCell> getCellNodes() {
+//    public List<RnibCell> getcellnodes() {
 //        List<RnibCell> list = Lists.newArrayList();
 //        cellMap.values().forEach(v -> list.add(v.value()));
 //        return list;
 //    }
 //
 //    @Override
-//    public List<RnibUe> getUeNodes() {
+//    public List<RnibUe> getuenodes() {
 //        List<RnibUe> list = Lists.newArrayList();
 //        ueMap.values().forEach(v -> list.add(v.value()));
 //        return list;
 //    }
 //
 //    @Override
-//    public Object getByNodeId(long nodeId) {
+//    public Object getbynodeid(long nodeId) {
 //        CellId cellId = CellId.valueOf(nodeId);
 //        if (cellMap.containsKey(cellId)) {
 //            return cellMap.get(cellId).value();
@@ -276,7 +276,7 @@
 //    }
 //
 //    @Override
-//    public boolean modifyCellRrmConf(JsonNode rrmConf) {
+//    public boolean modifycellrrmconf(JsonNode rrmConf) {
 //        return false;
 //    }
 //
diff --git a/src/main/java/org.onosproject.xran/impl/XranConfig.java b/src/main/java/org.onosproject.xran/impl/XranConfig.java
index eac3317..e334892 100644
--- a/src/main/java/org.onosproject.xran/impl/XranConfig.java
+++ b/src/main/java/org.onosproject.xran/impl/XranConfig.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
 package org.onosproject.xran.impl;
 
 import com.fasterxml.jackson.databind.JsonNode;
+import org.onlab.packet.IpAddress;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.config.Config;
 import org.onosproject.xran.codecs.api.ECGI;
@@ -33,6 +34,9 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+/**
+ * Xran config.
+ */
 public class XranConfig extends Config<ApplicationId> {
 
     private static final String CELLS = "active_cells";
@@ -63,8 +67,13 @@
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    public Map<String, ECGI> activeCellSet() {
-        Map<String, ECGI> cells = new ConcurrentHashMap<>();
+    /**
+     * Get a list of all CELLs inside the configuration file.
+     *
+     * @return Map of CELL IP to ECGI
+     */
+    public Map<IpAddress, ECGI> activeCellSet() {
+        Map<IpAddress, ECGI> cells = new ConcurrentHashMap<>();
 
         JsonNode cellsNode = object.get(CELLS);
         if (cellsNode == null) {
@@ -73,58 +82,110 @@
         }
 
         cellsNode.forEach(cellNode -> {
-            String plmn_id = cellNode.get(PLMN_ID).asText();
+            String plmnId = cellNode.get(PLMN_ID).asText();
             String eci = cellNode.get(ECI_ID).asText();
 
             String ipAddress = cellNode.get(IP_ADDR).asText();
 
-            ECGI ecgi = hexToECGI(plmn_id, eci);
-            cells.put(ipAddress, ecgi);
+            ECGI ecgi = hexToEcgi(plmnId, eci);
+            cells.put(IpAddress.valueOf(ipAddress), ecgi);
         });
 
         return cells;
     }
 
+    /**
+     * Get flag for ADMISSION_SUCCESS field in configuration.
+     *
+     * @return boolean value in configuration
+     */
     public boolean admissionFlag() {
         JsonNode flag = object.get(ADMISSION_SUCCESS);
         return flag != null && flag.asBoolean();
     }
 
+    /**
+     * Get flag for BEARER_SUCCESS field in configuration.
+     *
+     * @return boolean value in configuration
+     */
     public boolean bearerFlag() {
         JsonNode flag = object.get(BEARER_SUCCESS);
         return flag != null && flag.asBoolean();
     }
 
+    /**
+     * Get port for xRAN controller server to bind to from configuration.
+     *
+     * @return port number
+     */
     public int getXrancPort() {
         return object.get(XRANC_PORT).asInt();
     }
 
+    /**
+     * Get config request interval from configuration.
+     *
+     * @return interval in seconds
+     */
     public int getConfigRequestInterval() {
         return object.get(XRANC_CELLCONFIG_INTERVAL).asInt();
     }
 
+    /**
+     * Get rx signal interval from configuration.
+     *
+     * @return interval in milliseconds
+     */
     public int getRxSignalInterval() {
         return object.get(RX_SIGNAL_MEAS_REPORT_INTERVAL).asInt();
     }
 
+    /**
+     * Get l2 measurement interval from configuration.
+     *
+     * @return interval in milliseconds
+     */
     public int getL2MeasInterval() {
         return object.get(L2_MEAS_REPORT_INTERVAL).asInt();
     }
 
+    /**
+     * Get removal time of link after not getting measurement from configuration.
+     *
+     * @return interval in milliseconds
+     */
     public int getNoMeasLinkRemoval() {
         return object.get(NO_MEAS_LINK_REMOVAL).asInt();
     }
 
+    /**
+     * Get removal time of UE after being IDLE from configuration.
+     *
+     * @return interval in milliseconds
+     */
     public int getIdleUeRemoval() {
         return object.get(IDLE_UE_REMOVAL).asInt();
     }
 
+    /**
+     * Get northbound timeout when waiting for responses from configuration.
+     *
+     * @return interval in milliseconds
+     */
     public int getNorthBoundTimeout() {
         return object.get(NORTHBOUND_TIMEOUT).asInt();
     }
 
-    private ECGI hexToECGI(String plmn_id, String eci) {
-        byte[] bytes = HexConverter.fromShortHexString(plmn_id);
+    /**
+     * Get ECGI from HEX representation of PLMN_ID and ECI.
+     *
+     * @param plmnId  HEX string of PLMN_ID
+     * @param eci     HEX string of ECI
+     * @return new ECGI object
+     */
+    private ECGI hexToEcgi(String plmnId, String eci) {
+        byte[] bytes = HexConverter.fromShortHexString(plmnId);
         byte[] bytearray = DatatypeConverter.parseHexBinary(eci);
 
         InputStream inputStream = new ByteArrayInputStream(bytearray);
diff --git a/src/main/java/org.onosproject.xran/impl/package-info.java b/src/main/java/org.onosproject.xran/impl/package-info.java
index baf9a19..83cd67e 100644
--- a/src/main/java/org.onosproject.xran/impl/package-info.java
+++ b/src/main/java/org.onosproject.xran/impl/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
