diff --git a/src/main/java/org.onosproject.xran/XranStore.java b/src/main/java/org.onosproject.xran/XranStore.java
index 00984b9..63a1a02 100644
--- a/src/main/java/org.onosproject.xran/XranStore.java
+++ b/src/main/java/org.onosproject.xran/XranStore.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.
@@ -20,7 +20,6 @@
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.onosproject.store.Store;
 import org.onosproject.xran.codecs.api.ECGI;
-import org.onosproject.xran.codecs.api.MMEUES1APID;
 import org.onosproject.xran.controller.XranController;
 import org.onosproject.xran.entities.RnibCell;
 import org.onosproject.xran.entities.RnibLink;
@@ -37,65 +36,215 @@
 
     // LINKS STORE
 
+    /**
+     * Get all active links.
+     *
+     * @return list of links
+     */
     List<RnibLink> getLinks();
 
-    List<RnibLink> getLinksByECGI(ECGI ecgi);
+    /**
+     * Get all links for that CELL based on ECGI.
+     *
+     * @param ecgi CELL ECGI
+     * @return list of links
+     */
+    List<RnibLink> getlinksbyecgi(ECGI ecgi);
 
-    List<RnibLink> getLinksByCellId(String eciHex);
+    /**
+     * Get all links for that CELL based on ECI.
+     *
+     * @param eciHex HEX string of ECI
+     * @return list of links
+     */
+    List<RnibLink> getlinksbycellid(String eciHex);
 
-    List<RnibLink> getLinksByUeId(long ueId);
+    /**
+     * Get all links for the UE based on UE ID.
+     *
+     * @param ueId UE ID
+     * @return list of links
+     */
+    List<RnibLink> getlinksbyueid(long ueId);
 
-    RnibLink getLinkBetweenCellIdUeId(String cellId, long ueId);
+    /**
+     * Get a link between a CELL and UE.
+     *
+     * @param cellId HEX string ECI
+     * @param ueId   UE id
+     * @return link
+     */
+    RnibLink getlinkbetweencellidueid(String cellId, long ueId);
 
+    /**
+     * Get a link between a CELL's ECGI and UE's id.
+     *
+     * @param ecgi CELL ECGI
+     * @param ueId UE id
+     * @return link
+     */
     RnibLink getLink(ECGI ecgi, Long ueId);
 
-    void modifyLinkRrmConf(RnibLink link, JsonNode rrmConf);
+    /**
+     * Modify specified link's RRM Configuration.
+     *
+     * @param link    LINK entity
+     * @param rrmConf json node of RRM Configuration
+     */
+    void modifylinkrrmconf(RnibLink link, JsonNode rrmConf);
 
+    /**
+     * Put new link to store.
+     *
+     * @param link LINK entity
+     */
     void storeLink(RnibLink link);
 
+    /**
+     * Remove link from store.
+     *
+     * @param link LINK entity
+     * @return true if remove succeeded
+     */
     boolean removeLink(LinkId link);
 
     // NODES
 
+    /**
+     * Get all CELLs and UEs.
+     *
+     * @return list of UEs and CELLs
+     */
     List<Object> getNodes();
 
-    List<Object> getCellNodes();
+    /**
+     * Get all CELLs.
+     *
+     * @return list of CELLs
+     */
+    List<Object> getcellnodes();
 
-    List<Object> getUeNodes();
+    /**
+     * Get all UEs.
+     *
+     * @return list of UEs
+     */
+    List<Object> getuenodes();
 
-    Object getByNodeId(String nodeId);
+    /**
+     * Get node by node id.
+     *
+     * @param nodeId HEX string ECI or UE id
+     * @return CELL or UE
+     */
+    Object getbynodeid(String nodeId);
 
     // CELL
 
+    /**
+     * Get cell based on HEX string ECI.
+     *
+     * @param eci HEX string ECI
+     * @return CELL if found
+     */
     RnibCell getCell(String eci);
 
+    /**
+     * Get cell based on ECGI.
+     *
+     * @param cellId CELL ECGI
+     * @return CELL if found
+     */
     RnibCell getCell(ECGI cellId);
 
-    void modifyCellRrmConf(RnibCell cell, JsonNode rrmConf) throws Exception;
+    /**
+     * Modify CELL's RRM Configuration.
+     *
+     * @param cell    CELL entity
+     * @param rrmConf json node of RRM Configuration
+     * @throws Exception exception
+     */
+    void modifycellrrmconf(RnibCell cell, JsonNode rrmConf) throws Exception;
 
+    /**
+     * Put new CELL to the store.
+     *
+     * @param cell CELL entity
+     */
     void storeCell(RnibCell cell);
 
+    /**
+     * Remove CELL from the store.
+     *
+     * @param ecgi CELL's ECGI
+     * @return ture if remove succeeded
+     */
     boolean removeCell(ECGI ecgi);
 
     // SLICE
 
+    /**
+     * Get SLICE based on SLICE id.
+     *
+     * @param sliceId SLICE id
+     * @return SLICE
+     */
     RnibSlice getSlice(long sliceId);
 
+    /**
+     * Put new SLICE to the store.
+     *
+     * @param attributes json node of SLICE attributes
+     * @return true if put succeeded
+     */
     boolean createSlice(ObjectNode attributes);
 
+    /**
+     * Remove SLICE based on SLICE id.
+     *
+     * @param sliceId SLICE id
+     * @return true if remove succeeded
+     */
     boolean removeCell(long sliceId);
 
     // CONTROLLER
 
+    /**
+     * Get the xran controller instance.
+     *
+     * @return xran controller
+     */
     XranController getController();
 
+    /**
+     * Set the xran controller instance.
+     *
+     * @param controller xran controller
+     */
     void setController(XranController controller);
 
     // UE
 
+    /**
+     * Get UE based on UE id.
+     *
+     * @param euId UE id
+     * @return UE entity
+     */
     RnibUe getUe(long euId);
 
+    /**
+     * Put new UE to store.
+     *
+     * @param ue UE entity
+     */
     void storeUe(RnibUe ue);
 
+    /**
+     * Remove UE from store.
+     *
+     * @param ueId UE id
+     * @return true if remove succeeded
+     */
     boolean removeUe(long ueId);
 }
diff --git a/src/main/java/org.onosproject.xran/annotations/Patch.java b/src/main/java/org.onosproject.xran/annotations/Patch.java
index 8058902..bc882c5 100644
--- a/src/main/java/org.onosproject.xran/annotations/Patch.java
+++ b/src/main/java/org.onosproject.xran/annotations/Patch.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
@@ -23,7 +23,7 @@
 import java.lang.annotation.Target;
 
 /**
- * Created by dimitris on 7/21/17.
+ * PATCH interface for swagger.
  */
 @Target({ElementType.METHOD})
 @Retention(RetentionPolicy.RUNTIME)
diff --git a/src/main/java/org.onosproject.xran/annotations/package-info.java b/src/main/java/org.onosproject.xran/annotations/package-info.java
index e035cf2..0f85a05 100644
--- a/src/main/java/org.onosproject.xran/annotations/package-info.java
+++ b/src/main/java/org.onosproject.xran/annotations/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java b/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java
index a02833d..7a44283 100644
--- a/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java
+++ b/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java
@@ -16,168 +16,172 @@
 
 public class PCIARFCN implements Serializable {
 
-	private static final long serialVersionUID = 1L;
+    public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
+    private static final long serialVersionUID = 1L;
+    @JsonIgnore
+    public byte[] code = null;
+    private PhysCellId pci = null;
+    private ARFCNValue earfcnDl = null;
 
-	public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
+    public PCIARFCN() {
+    }
 
-	@JsonIgnore
-	public byte[] code = null;
-	private PhysCellId pci = null;
-	private ARFCNValue earfcnDl = null;
-	
-	public PCIARFCN() {
-	}
+    public PCIARFCN(byte[] code) {
+        this.code = code;
+    }
 
-	public PCIARFCN(byte[] code) {
-		this.code = code;
-	}
+    public static PCIARFCN valueOf(PhysCellId pci, ARFCNValue arfcnValue) {
+        PCIARFCN pciarfcn = new PCIARFCN();
+        pciarfcn.setEarfcnDl(arfcnValue);
+        pciarfcn.setPci(pci);
+        return pciarfcn;
+    }
 
-	public void setPci(PhysCellId pci) {
-		this.pci = pci;
-	}
+    public PhysCellId getPci() {
+        return pci;
+    }
 
-	public PhysCellId getPci() {
-		return pci;
-	}
+    public void setPci(PhysCellId pci) {
+        this.pci = pci;
+    }
 
-	public void setEarfcnDl(ARFCNValue earfcnDl) {
-		this.earfcnDl = earfcnDl;
-	}
+    public ARFCNValue getEarfcnDl() {
+        return earfcnDl;
+    }
 
-	public ARFCNValue getEarfcnDl() {
-		return earfcnDl;
-	}
+    public void setEarfcnDl(ARFCNValue earfcnDl) {
+        this.earfcnDl = earfcnDl;
+    }
 
-	public int encode(BerByteArrayOutputStream os) throws IOException {
-		return encode(os, true);
-	}
+    public int encode(BerByteArrayOutputStream os) throws IOException {
+        return encode(os, true);
+    }
 
-	public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
+    public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
 
-		if (code != null) {
-			for (int i = code.length - 1; i >= 0; i--) {
-				os.write(code[i]);
-			}
-			if (withTag) {
-				return tag.encode(os) + code.length;
-			}
-			return code.length;
-		}
+        if (code != null) {
+            for (int i = code.length - 1; i >= 0; i--) {
+                os.write(code[i]);
+            }
+            if (withTag) {
+                return tag.encode(os) + code.length;
+            }
+            return code.length;
+        }
 
-		int codeLength = 0;
-		codeLength += earfcnDl.encode(os, false);
-		// write tag: CONTEXT_CLASS, PRIMITIVE, 1
-		os.write(0x81);
-		codeLength += 1;
-		
-		codeLength += pci.encode(os, false);
-		// write tag: CONTEXT_CLASS, PRIMITIVE, 0
-		os.write(0x80);
-		codeLength += 1;
-		
-		codeLength += BerLength.encodeLength(os, codeLength);
+        int codeLength = 0;
+        codeLength += earfcnDl.encode(os, false);
+        // write tag: CONTEXT_CLASS, PRIMITIVE, 1
+        os.write(0x81);
+        codeLength += 1;
 
-		if (withTag) {
-			codeLength += tag.encode(os);
-		}
+        codeLength += pci.encode(os, false);
+        // write tag: CONTEXT_CLASS, PRIMITIVE, 0
+        os.write(0x80);
+        codeLength += 1;
 
-		return codeLength;
+        codeLength += BerLength.encodeLength(os, codeLength);
 
-	}
+        if (withTag) {
+            codeLength += tag.encode(os);
+        }
 
-	public int decode(InputStream is) throws IOException {
-		return decode(is, true);
-	}
+        return codeLength;
 
-	public int decode(InputStream is, boolean withTag) throws IOException {
-		int codeLength = 0;
-		int subCodeLength = 0;
-		BerTag berTag = new BerTag();
+    }
 
-		if (withTag) {
-			codeLength += tag.decodeAndCheck(is);
-		}
+    public int decode(InputStream is) throws IOException {
+        return decode(is, true);
+    }
 
-		BerLength length = new BerLength();
-		codeLength += length.decode(is);
+    public int decode(InputStream is, boolean withTag) throws IOException {
+        int codeLength = 0;
+        int subCodeLength = 0;
+        BerTag berTag = new BerTag();
 
-		int totalLength = length.val;
-		codeLength += totalLength;
+        if (withTag) {
+            codeLength += tag.decodeAndCheck(is);
+        }
 
-		subCodeLength += berTag.decode(is);
-		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
-			pci = new PhysCellId();
-			subCodeLength += pci.decode(is, false);
-			subCodeLength += berTag.decode(is);
-		}
-		else {
-			throw new IOException("Tag does not match the mandatory sequence element tag.");
-		}
-		
-		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
-			earfcnDl = new ARFCNValue();
-			subCodeLength += earfcnDl.decode(is, false);
-			if (subCodeLength == totalLength) {
-				return codeLength;
-			}
-		}
-		throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
+        BerLength length = new BerLength();
+        codeLength += length.decode(is);
 
-		
-	}
+        int totalLength = length.val;
+        codeLength += totalLength;
 
-	public void encodeAndSave(int encodingSizeGuess) throws IOException {
-		BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
-		encode(os, false);
-		code = os.getArray();
-	}
+        subCodeLength += berTag.decode(is);
+        if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
+            pci = new PhysCellId();
+            subCodeLength += pci.decode(is, false);
+            subCodeLength += berTag.decode(is);
+        } else {
+            throw new IOException("Tag does not match the mandatory sequence element tag.");
+        }
 
-	public String toString() {
-		StringBuilder sb = new StringBuilder();
-		appendAsString(sb, 0);
-		return sb.toString();
-	}
+        if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
+            earfcnDl = new ARFCNValue();
+            subCodeLength += earfcnDl.decode(is, false);
+            if (subCodeLength == totalLength) {
+                return codeLength;
+            }
+        }
+        throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
 
-	public void appendAsString(StringBuilder sb, int indentLevel) {
 
-		sb.append("{");
-		sb.append("\n");
-		for (int i = 0; i < indentLevel + 1; i++) {
-			sb.append("\t");
-		}
-		if (pci != null) {
-			sb.append("pci: ").append(pci);
-		}
-		
-		sb.append(",\n");
-		for (int i = 0; i < indentLevel + 1; i++) {
-			sb.append("\t");
-		}
-		if (earfcnDl != null) {
-			sb.append("earfcnDl: ").append(earfcnDl);
-		}
-		
-		sb.append("\n");
-		for (int i = 0; i < indentLevel; i++) {
-			sb.append("\t");
-		}
-		sb.append("}");
-	}
+    }
 
-	@Override
-	public boolean equals(Object o) {
-		if (o instanceof PCIARFCN) {
-			return pci.equals(((PCIARFCN) o).getPci()) && earfcnDl.equals(((PCIARFCN) o).getEarfcnDl());
-		}
+    public void encodeAndSave(int encodingSizeGuess) throws IOException {
+        BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
+        encode(os, false);
+        code = os.getArray();
+    }
 
-		return super.equals(o);
-	}
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        appendAsString(sb, 0);
+        return sb.toString();
+    }
 
-	@Override
-	public int hashCode() {
-		int result = pci.hashCode();
-		result = 31 * result + earfcnDl.hashCode();
-		return result;
-	}
+    public void appendAsString(StringBuilder sb, int indentLevel) {
+
+        sb.append("{");
+        sb.append("\n");
+        for (int i = 0; i < indentLevel + 1; i++) {
+            sb.append("\t");
+        }
+        if (pci != null) {
+            sb.append("pci: ").append(pci);
+        }
+
+        sb.append(",\n");
+        for (int i = 0; i < indentLevel + 1; i++) {
+            sb.append("\t");
+        }
+        if (earfcnDl != null) {
+            sb.append("earfcnDl: ").append(earfcnDl);
+        }
+
+        sb.append("\n");
+        for (int i = 0; i < indentLevel; i++) {
+            sb.append("\t");
+        }
+        sb.append("}");
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o instanceof PCIARFCN) {
+            return pci.equals(((PCIARFCN) o).getPci()) && earfcnDl.equals(((PCIARFCN) o).getEarfcnDl());
+        }
+
+        return super.equals(o);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = pci.hashCode();
+        result = 31 * result + earfcnDl.hashCode();
+        return result;
+    }
 }
 
diff --git a/src/main/java/org.onosproject.xran/codecs/api/package-info.java b/src/main/java/org.onosproject.xran/codecs/api/package-info.java
index e3949c9..ace3595 100644
--- a/src/main/java/org.onosproject.xran/codecs/api/package-info.java
+++ b/src/main/java/org.onosproject.xran/codecs/api/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.
diff --git a/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java b/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java
index 570aae0..f258255 100644
--- a/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java
+++ b/src/main/java/org.onosproject.xran/codecs/pdu/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.
diff --git a/src/main/java/org.onosproject.xran/controller/Controller.java b/src/main/java/org.onosproject.xran/controller/Controller.java
index 2191f5b..946a1bd 100644
--- a/src/main/java/org.onosproject.xran/controller/Controller.java
+++ b/src/main/java/org.onosproject.xran/controller/Controller.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.
@@ -42,6 +42,9 @@
     private int port = 8007;
     private boolean isRunning = false;
 
+    /**
+     * Run SCTP server.
+     */
     public void run() {
         final Controller ctrl = this;
         try {
@@ -62,6 +65,11 @@
         }
     }
 
+    /**
+     * Create bootstrap for server.
+     *
+     * @return server bootstrap
+     */
     private ServerBootstrap createServerBootStrap() {
         bossGroup = new NioEventLoopGroup(1);
         workerGroup = new NioEventLoopGroup();
@@ -73,6 +81,14 @@
         return b;
     }
 
+    /**
+     * Initialize controller and start SCTP server.
+     *
+     * @param deviceAgent device agent
+     * @param hostAgent   host agent
+     * @param packetAgent packet agent
+     * @param port        port of server
+     */
     public void start(XranDeviceAgent deviceAgent, XranHostAgent hostAgent, XranPacketProcessor packetAgent, int port) {
         if (isRunning && this.port != port) {
             stop();
@@ -91,7 +107,9 @@
         }
     }
 
-
+    /**
+     * Stop SCTP server.
+     */
     public void stop() {
         if (isRunning) {
             channel.channel().close();
diff --git a/src/main/java/org.onosproject.xran/controller/XranChannelHandler.java b/src/main/java/org.onosproject.xran/controller/XranChannelHandler.java
index 764f55c..d429602 100644
--- a/src/main/java/org.onosproject.xran/controller/XranChannelHandler.java
+++ b/src/main/java/org.onosproject.xran/controller/XranChannelHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
@@ -36,9 +36,8 @@
 import java.net.URISyntaxException;
 
 /**
- * Created by dimitris on 7/20/17.
+ * Xran channel handler.
  */
-
 @Sharable
 public class XranChannelHandler extends ChannelInboundHandlerAdapter {
 
@@ -51,6 +50,13 @@
         this.controller = controller;
     }
 
+    /**
+     * Given PDU construct an SCTP message.
+     *
+     * @param pdu PDU packet
+     * @return SCTP message
+     * @throws IOException IO exception
+     */
     public static SctpMessage getSctpMessage(XrancPdu pdu) throws IOException {
         BerByteArrayOutputStream os = new BerByteArrayOutputStream(4096);
 
@@ -90,13 +96,13 @@
         byte[] bytes = new byte[byteBuf.readableBytes()];
         byteBuf.readBytes(bytes);
 
-        XrancPdu recv_pdu = new XrancPdu();
+        XrancPdu recvPdu = new XrancPdu();
 
         InputStream inputStream = new ByteArrayInputStream(bytes);
 
-        recv_pdu.decode(inputStream);
+        recvPdu.decode(inputStream);
 
-        controller.packetAgent.handlePacket(recv_pdu, ctx);
+        controller.packetAgent.handlePacket(recvPdu, ctx);
     }
 
     @Override
diff --git a/src/main/java/org.onosproject.xran/controller/XranController.java b/src/main/java/org.onosproject.xran/controller/XranController.java
index 0ab91ef..b08c714 100644
--- a/src/main/java/org.onosproject.xran/controller/XranController.java
+++ b/src/main/java/org.onosproject.xran/controller/XranController.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.
@@ -28,23 +28,73 @@
  */
 public interface XranController {
 
+    /**
+     * Send a HandOff request from one link to another.
+     *
+     * @param newLink target LINK entity
+     * @param oldLink source LINK entity
+     * @return blocking queue for RESPONSE
+     * @throws InterruptedException interrupted exception
+     */
     SynchronousQueue<String> sendHORequest(RnibLink newLink, RnibLink oldLink) throws InterruptedException;
 
+    /**
+     * Add a device listener for CELL connections.
+     *
+     * @param listener listener
+     */
     void addListener(XranDeviceListener listener);
 
+    /**
+     * Add a host listener for UE connections.
+     *
+     * @param listener listener
+     */
     void addListener(XranHostListener listener);
 
+    /**
+     * Remove a CELL device listener.
+     *
+     * @param listener listener
+     */
     void removeListener(XranDeviceListener listener);
 
+    /**
+     * Remove a UE host listener.
+     *
+     * @param listener listener
+     */
     void removeListener(XranHostListener listener);
 
-    SynchronousQueue<String> sendModifiedRRMConf(RRMConfig rrmConfig, boolean xICIC);
+    /**
+     * Send modified RRM configuration or xICICConfing.
+     *
+     * @param rrmConfig configuration fields to send
+     * @param xicic     if true sends xicic else it sends RRM
+     * @return blocking queue for RESPONSE
+     */
+    SynchronousQueue<String> sendmodifiedrrmconf(RRMConfig rrmConfig, boolean xicic);
 
+    /**
+     * Send scell add packet for specified LINK.
+     *
+     * @param link LINK entity
+     * @return blocking queue for RESPONSE
+     */
     SynchronousQueue<String> sendScellAdd(RnibLink link);
 
+    /**
+     * Send scell delete for specified LINK.
+     *
+     * @param link LINK entity
+     * @return true if sent correctly
+     */
     boolean sendScellDelete(RnibLink link);
 
-    int getNorthbound_timeout();
-
-    void setNorthbound_timeout(int northbound_timeout);
+    /**
+     * Get northbound timeout.
+     *
+     * @return interval in milliseconds
+     */
+    int getNorthboundTimeout();
 }
diff --git a/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java b/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java
index 99e79a7..8040cea 100644
--- a/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java
+++ b/src/main/java/org.onosproject.xran/controller/XranControllerImpl.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.
@@ -20,10 +20,21 @@
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.sctp.SctpMessage;
 import org.apache.commons.lang.exception.ExceptionUtils;
-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.onlab.packet.IpAddress;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
-import org.onosproject.net.config.*;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
 import org.onosproject.net.config.basics.SubjectFactories;
 import org.onosproject.net.device.DeviceEvent;
 import org.onosproject.net.device.DeviceListener;
@@ -32,15 +43,59 @@
 import org.onosproject.net.host.HostListener;
 import org.onosproject.net.host.HostService;
 import org.onosproject.xran.XranStore;
-import org.onosproject.xran.codecs.api.*;
+import org.onosproject.xran.codecs.api.CRNTI;
+import org.onosproject.xran.codecs.api.ECGI;
+import org.onosproject.xran.codecs.api.ERABID;
+import org.onosproject.xran.codecs.api.ERABParams;
+import org.onosproject.xran.codecs.api.ERABParamsItem;
+import org.onosproject.xran.codecs.api.PCIARFCN;
+import org.onosproject.xran.codecs.api.PropScell;
+import org.onosproject.xran.codecs.api.RSRPRange;
+import org.onosproject.xran.codecs.api.RSRQRange;
+import org.onosproject.xran.codecs.api.RXSigReport;
+import org.onosproject.xran.codecs.api.RadioRepPerServCell;
+import org.onosproject.xran.codecs.api.SchedMeasRepPerServCell;
+import org.onosproject.xran.codecs.api.TrafficSplitPercentage;
 import org.onosproject.xran.codecs.ber.types.BerInteger;
-import org.onosproject.xran.codecs.pdu.*;
+import org.onosproject.xran.codecs.pdu.BearerAdmissionRequest;
+import org.onosproject.xran.codecs.pdu.BearerAdmissionResponse;
+import org.onosproject.xran.codecs.pdu.BearerAdmissionStatus;
+import org.onosproject.xran.codecs.pdu.BearerReleaseInd;
+import org.onosproject.xran.codecs.pdu.CellConfigReport;
+import org.onosproject.xran.codecs.pdu.CellConfigRequest;
+import org.onosproject.xran.codecs.pdu.HOComplete;
+import org.onosproject.xran.codecs.pdu.HOFailure;
+import org.onosproject.xran.codecs.pdu.HORequest;
+import org.onosproject.xran.codecs.pdu.L2MeasConfig;
+import org.onosproject.xran.codecs.pdu.PDCPMeasReportPerUe;
+import org.onosproject.xran.codecs.pdu.RRMConfig;
+import org.onosproject.xran.codecs.pdu.RRMConfigStatus;
+import org.onosproject.xran.codecs.pdu.RXSigMeasConfig;
+import org.onosproject.xran.codecs.pdu.RXSigMeasReport;
+import org.onosproject.xran.codecs.pdu.RadioMeasReportPerCell;
+import org.onosproject.xran.codecs.pdu.RadioMeasReportPerUE;
+import org.onosproject.xran.codecs.pdu.ScellAdd;
+import org.onosproject.xran.codecs.pdu.ScellAddStatus;
+import org.onosproject.xran.codecs.pdu.ScellDelete;
+import org.onosproject.xran.codecs.pdu.SchedMeasReportPerCell;
+import org.onosproject.xran.codecs.pdu.SchedMeasReportPerUE;
+import org.onosproject.xran.codecs.pdu.TrafficSplitConfig;
+import org.onosproject.xran.codecs.pdu.UEAdmissionRequest;
+import org.onosproject.xran.codecs.pdu.UEAdmissionResponse;
+import org.onosproject.xran.codecs.pdu.UEAdmissionStatus;
+import org.onosproject.xran.codecs.pdu.UECapabilityEnquiry;
+import org.onosproject.xran.codecs.pdu.UECapabilityInfo;
+import org.onosproject.xran.codecs.pdu.UEContextUpdate;
+import org.onosproject.xran.codecs.pdu.UEReconfigInd;
+import org.onosproject.xran.codecs.pdu.UEReleaseInd;
+import org.onosproject.xran.codecs.pdu.XICICConfig;
+import org.onosproject.xran.codecs.pdu.XrancPdu;
 import org.onosproject.xran.entities.RnibCell;
 import org.onosproject.xran.entities.RnibLink;
 import org.onosproject.xran.entities.RnibUe;
+import org.onosproject.xran.identifiers.ContextUpdateHandler;
 import org.onosproject.xran.identifiers.EcgiCrntiPair;
 import org.onosproject.xran.identifiers.LinkId;
-import org.onosproject.xran.identifiers.contextUpdateHandler;
 import org.onosproject.xran.impl.XranConfig;
 import org.onosproject.xran.providers.XranDeviceListener;
 import org.onosproject.xran.providers.XranHostListener;
@@ -51,8 +106,18 @@
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.SynchronousQueue;
 import java.util.stream.Collectors;
 
 import static org.onosproject.net.DeviceId.deviceId;
@@ -79,7 +144,7 @@
     private final Controller controller = new Controller();
     private XranConfig xranConfig;
     private ApplicationId appId;
-    private int northbound_timeout;
+    private int northboundTimeout;
     /* Services */
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     private DeviceService deviceService;
@@ -106,11 +171,11 @@
     private UeMap ueMap;
     private LinkMap linkMap;
     /* MAPS */
-    private ConcurrentMap<String, ECGI> legitCells = new ConcurrentHashMap<>();
+    private ConcurrentMap<IpAddress, ECGI> legitCells = new ConcurrentHashMap<>();
     private ConcurrentMap<ECGI, SynchronousQueue<String>> hoMap = new ConcurrentHashMap<>();
-    private ConcurrentMap<ECGI, SynchronousQueue<String>> RRMCellMap = new ConcurrentHashMap<>();
+    private ConcurrentMap<ECGI, SynchronousQueue<String>> rrmcellMap = new ConcurrentHashMap<>();
     private ConcurrentMap<CRNTI, SynchronousQueue<String>> scellAddMap = new ConcurrentHashMap<>();
-    private ConcurrentMap<EcgiCrntiPair, contextUpdateHandler> contextUpdateMap = new ConcurrentHashMap<>();
+    private ConcurrentMap<EcgiCrntiPair, ContextUpdateHandler> contextUpdateMap = new ConcurrentHashMap<>();
     /* QUEUE */
     private BlockingQueue<Long> ueIdQueue = new LinkedBlockingQueue<>();
     /* AGENTS */
@@ -120,8 +185,8 @@
     /* LISTENERS */
     private Set<XranDeviceListener> xranDeviceListeners = new CopyOnWriteArraySet<>();
     private Set<XranHostListener> xranHostListeners = new CopyOnWriteArraySet<>();
-    private InternalDeviceListener device_listener = new InternalDeviceListener();
-    private InternalHostListener host_listener = new InternalHostListener();
+    private InternalDeviceListener deviceListener = new InternalDeviceListener();
+    private InternalHostListener hostListener = new InternalHostListener();
 
     @Activate
     public void activate() {
@@ -129,8 +194,8 @@
 
         configService.addListener(configListener);
         registry.registerConfigFactory(xranConfigFactory);
-        deviceService.addListener(device_listener);
-        hostService.addListener(host_listener);
+        deviceService.addListener(deviceListener);
+        hostService.addListener(hostListener);
 
         cellMap = new CellMap(xranStore);
         ueMap = new UeMap(xranStore);
@@ -145,8 +210,8 @@
     public void deactivate() {
         controller.stop();
 
-        deviceService.removeListener(device_listener);
-        hostService.removeListener(host_listener);
+        deviceService.removeListener(deviceListener);
+        hostService.removeListener(hostListener);
 
         legitCells.clear();
 
@@ -157,29 +222,30 @@
     }
 
     @Override
-    public SynchronousQueue<String> sendHORequest(RnibLink link_t, RnibLink link_s) throws InterruptedException {
-        ECGI ecgi_t = link_t.getLinkId().getEcgi(),
-                ecgi_s = link_s.getLinkId().getEcgi();
+    public SynchronousQueue<String> sendHORequest(RnibLink linkT, RnibLink linkS) throws InterruptedException {
+        ECGI ecgiT = linkT.getLinkId().getEcgi(),
+                ecgiS = linkS.getLinkId().getEcgi();
 
-        CRNTI crnti = linkMap.getCrnti(link_t.getLinkId().getUeId());
-        ChannelHandlerContext ctx_t = cellMap.getCtx(ecgi_t),
-                ctx_s = cellMap.getCtx(ecgi_s);
-
+        CRNTI crnti = linkMap.getCrnti(linkT.getLinkId().getUeId());
+        ChannelHandlerContext ctxT = cellMap.getCtx(ecgiT),
+                ctxS = cellMap.getCtx(ecgiS);
 
         SynchronousQueue<String> queue = new SynchronousQueue<>();
         try {
-            XrancPdu xrancPdu = HORequest.constructPacket(crnti, ecgi_s, ecgi_t);
+            XrancPdu xrancPdu = HORequest.constructPacket(crnti, ecgiS, ecgiT);
 
-            hoMap.put(ecgi_s, queue);
+            // temporary map that has ECGI source of a handoff to a queue waiting for REST response.
+            hoMap.put(ecgiS, queue);
 
-            ctx_t.writeAndFlush(getSctpMessage(xrancPdu));
-            ctx_s.writeAndFlush(getSctpMessage(xrancPdu));
+            ctxT.writeAndFlush(getSctpMessage(xrancPdu));
+            ctxS.writeAndFlush(getSctpMessage(xrancPdu));
+
+            // FIXME: only works for one HO at a time.
+            ueIdQueue.put(linkT.getLinkId().getUeId());
         } catch (IOException e) {
             e.printStackTrace();
         }
 
-        ueIdQueue.put(link_t.getLinkId().getUeId());
-
         return queue;
     }
 
@@ -204,23 +270,18 @@
     }
 
     @Override
-    public int getNorthbound_timeout() {
-        return northbound_timeout;
+    public int getNorthboundTimeout() {
+        return northboundTimeout;
     }
 
     @Override
-    public void setNorthbound_timeout(int northbound_timeout) {
-        this.northbound_timeout = northbound_timeout;
-    }
-
-    @Override
-    public SynchronousQueue<String> sendModifiedRRMConf(RRMConfig rrmConfig, boolean xICIC) {
+    public SynchronousQueue<String> sendmodifiedrrmconf(RRMConfig rrmConfig, boolean xicic) {
         ECGI ecgi = rrmConfig.getEcgi();
         ChannelHandlerContext ctx = cellMap.getCtx(ecgi);
         try {
             XrancPdu pdu;
 
-            if (xICIC) {
+            if (xicic) {
                 CellConfigReport cellConfigReport = cellMap.get(ecgi).getConf();
                 if (cellConfigReport != null) {
                     pdu = XICICConfig.constructPacket(rrmConfig, cellConfigReport);
@@ -230,7 +291,7 @@
                 pdu = RRMConfig.constructPacket(rrmConfig);
                 ctx.writeAndFlush(getSctpMessage(pdu));
                 SynchronousQueue<String> queue = new SynchronousQueue<>();
-                RRMCellMap.put(ecgi, queue);
+                rrmcellMap.put(ecgi, queue);
                 return queue;
             }
         } catch (IOException e) {
@@ -304,6 +365,11 @@
         return false;
     }
 
+    /**
+     * Timer to delete UE after being IDLE.
+     *
+     * @param ue UE entity
+     */
     private void restartTimer(RnibUe ue) {
         Timer timer = new Timer();
         ue.setTimer(timer);
@@ -320,6 +386,11 @@
         }, xranConfig.getIdleUeRemoval());
     }
 
+    /**
+     * Timer to delete LINK after not receiving measurements.
+     *
+     * @param link LINK entity
+     */
     private void restartTimer(RnibLink link) {
         Timer timer = new Timer();
         link.setTimer(timer);
@@ -328,12 +399,49 @@
             public void run() {
                 LinkId linkId = link.getLinkId();
                 xranStore.removeLink(linkId);
-                log.info("Link is removed after not receiving Meas Reports for {} ms", xranConfig.getNoMeasLinkRemoval());
+                log.info("Link is removed after not receiving Meas Reports for {} ms",
+                        xranConfig.getNoMeasLinkRemoval());
             }
         }, xranConfig.getNoMeasLinkRemoval());
 
     }
 
+    /**
+     * Request measurement configuration field of specified UE.
+     *
+     * @param primary primary CELL
+     * @param ue      UE entity
+     */
+    private void populateMeasConfig(RnibCell primary, RnibUe ue) {
+        try {
+            ChannelHandlerContext ctx = cellMap.getCtx(primary.getEcgi());
+            RXSigMeasConfig.MeasCells measCells = new RXSigMeasConfig.MeasCells();
+            xranStore.getcellnodes().forEach(cell -> {
+                CellConfigReport cellReport = ((RnibCell) cell).getConf();
+                if (cellReport != null) {
+                    PCIARFCN pciarfcn = new PCIARFCN();
+                    pciarfcn.setPci(cellReport.getPci());
+                    pciarfcn.setEarfcnDl(cellReport.getEarfcnDl());
+                    measCells.setPCIARFCN(pciarfcn);
+                }
+            });
+            XrancPdu xrancPdu = RXSigMeasConfig.constructPacket(
+                    primary.getEcgi(),
+                    ue.getCrnti(),
+                    measCells,
+                    xranConfig.getRxSignalInterval()
+            );
+            ue.setMeasConfig(xrancPdu.getBody().getRXSigMeasConfig());
+            ctx.writeAndFlush(getSctpMessage(xrancPdu));
+        } catch (IOException e) {
+            log.warn(ExceptionUtils.getFullStackTrace(e));
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Internal device listener.
+     */
     class InternalDeviceListener implements DeviceListener {
 
         @Override
@@ -361,14 +469,15 @@
                                                     e.printStackTrace();
                                                 }
                                             } else {
-                                                List<Object> ueNodes = xranStore.getUeNodes();
+                                                List<Object> ueNodes = xranStore.getuenodes();
                                                 ueNodes.forEach(object -> {
                                                     RnibUe ue = (RnibUe) object;
                                                     try {
-                                                        ECGI primary_ecgi = linkMap.getPrimaryCell(ue).getEcgi();
-                                                        ChannelHandlerContext ctx = cellMap.getCtx(primary_ecgi);
-                                                        RXSigMeasConfig.MeasCells measCells = new RXSigMeasConfig.MeasCells();
-                                                        xranStore.getCellNodes().forEach(cell -> {
+                                                        ECGI primaryEcgi = linkMap.getPrimaryCell(ue).getEcgi();
+                                                        ChannelHandlerContext ctx = cellMap.getCtx(primaryEcgi);
+                                                        RXSigMeasConfig.MeasCells measCells =
+                                                                new RXSigMeasConfig.MeasCells();
+                                                        xranStore.getcellnodes().forEach(cell -> {
                                                             CellConfigReport cellReport = ((RnibCell) cell).getConf();
                                                             if (cellReport != null) {
                                                                 PCIARFCN pciarfcn = new PCIARFCN();
@@ -378,7 +487,7 @@
                                                             }
                                                         });
                                                         XrancPdu xrancPdu = RXSigMeasConfig.constructPacket(
-                                                                primary_ecgi,
+                                                                primaryEcgi,
                                                                 ue.getCrnti(),
                                                                 measCells,
                                                                 xranConfig.getRxSignalInterval()
@@ -393,7 +502,8 @@
 
                                                 try {
                                                     ChannelHandlerContext ctx = cellMap.getCtx(ecgi);
-                                                    XrancPdu xrancPdu = L2MeasConfig.constructPacket(ecgi, xranConfig.getL2MeasInterval());
+                                                    XrancPdu xrancPdu = L2MeasConfig
+                                                            .constructPacket(ecgi, xranConfig.getL2MeasInterval());
                                                     cell.setMeasConfig(xrancPdu.getBody().getL2MeasConfig());
                                                     SctpMessage sctpMessage = getSctpMessage(xrancPdu);
                                                     ctx.writeAndFlush(sctpMessage);
@@ -423,6 +533,9 @@
         }
     }
 
+    /**
+     * Internal host listener.
+     */
     class InternalHostListener implements HostListener {
 
         @Override
@@ -433,8 +546,8 @@
                 case HOST_MOVED: {
                     RnibUe ue = ueMap.get(hostIdtoUEId(event.subject().id()));
                     if (ue != null) {
-                        ECGI ecgi_primary = linkMap.getPrimaryCell(ue).getEcgi();
-                        RnibCell primary = cellMap.get(ecgi_primary);
+                        ECGI ecgiPrimary = linkMap.getPrimaryCell(ue).getEcgi();
+                        RnibCell primary = cellMap.get(ecgiPrimary);
                         ue.setMeasConfig(null);
                         if (primary != null) {
                             Timer timer = new Timer();
@@ -463,30 +576,7 @@
                                     xranConfig.getConfigRequestInterval() * 1000
                             );
                             if (ue.getMeasConfig() == null) {
-                                try {
-                                    ChannelHandlerContext ctx = cellMap.getCtx(primary.getEcgi());
-                                    RXSigMeasConfig.MeasCells measCells = new RXSigMeasConfig.MeasCells();
-                                    xranStore.getCellNodes().forEach(cell -> {
-                                        CellConfigReport cellReport = ((RnibCell) cell).getConf();
-                                        if (cellReport != null) {
-                                            PCIARFCN pciarfcn = new PCIARFCN();
-                                            pciarfcn.setPci(cellReport.getPci());
-                                            pciarfcn.setEarfcnDl(cellReport.getEarfcnDl());
-                                            measCells.setPCIARFCN(pciarfcn);
-                                        }
-                                    });
-                                    XrancPdu xrancPdu = RXSigMeasConfig.constructPacket(
-                                            primary.getEcgi(),
-                                            ue.getCrnti(),
-                                            measCells,
-                                            xranConfig.getRxSignalInterval()
-                                    );
-                                    ue.setMeasConfig(xrancPdu.getBody().getRXSigMeasConfig());
-                                    ctx.writeAndFlush(getSctpMessage(xrancPdu));
-                                } catch (IOException e) {
-                                    log.warn(ExceptionUtils.getFullStackTrace(e));
-                                    e.printStackTrace();
-                                }
+                                populateMeasConfig(primary, ue);
                             }
                         }
                     }
@@ -499,13 +589,16 @@
         }
     }
 
+    /**
+     * Internal xran device agent.
+     */
     public class InternalXranDeviceAgent implements XranDeviceAgent {
 
         private final Logger log = LoggerFactory.getLogger(InternalXranDeviceAgent.class);
 
         @Override
         public boolean addConnectedCell(String host, ChannelHandlerContext ctx) {
-            ECGI ecgi = legitCells.get(host);
+            ECGI ecgi = legitCells.get(IpAddress.valueOf(host));
 
             if (ecgi == null) {
                 log.error("Device is not a legit source; ignoring...");
@@ -531,10 +624,10 @@
 
         @Override
         public boolean removeConnectedCell(String host) {
-            ECGI ecgi = legitCells.get(host);
-            List<RnibLink> linksByECGI = xranStore.getLinksByECGI(ecgi);
+            ECGI ecgi = legitCells.get(IpAddress.valueOf(host));
+            List<RnibLink> linksbyecgi = xranStore.getlinksbyecgi(ecgi);
 
-            linksByECGI.forEach(rnibLink -> xranStore.removeLink(rnibLink.getLinkId()));
+            linksbyecgi.forEach(rnibLink -> xranStore.removeLink(rnibLink.getLinkId()));
 
             if (cellMap.remove(ecgi)) {
                 for (XranDeviceListener l : xranDeviceListeners) {
@@ -546,6 +639,9 @@
         }
     }
 
+    /**
+     * Internal xran host agent.
+     */
     public class InternalXranHostAgent implements XranHostAgent {
 
         @Override
@@ -556,10 +652,11 @@
 
                 Set<ECGI> ecgiSet = Sets.newConcurrentHashSet();
 
-                ecgiSet.add(xranStore.getLinksByUeId(ue.getId())
+                xranStore.getlinksbyueid(ue.getId())
                         .stream()
                         .filter(l -> l.getType().equals(RnibLink.Type.SERVING_PRIMARY))
-                        .findFirst().get().getLinkId().getEcgi());
+                        .findFirst()
+                        .ifPresent(l -> ecgiSet.add(l.getLinkId().getEcgi()));
 
                 for (XranHostListener l : xranHostListeners) {
                     l.hostAdded(ue, ecgiSet);
@@ -581,7 +678,7 @@
 
         @Override
         public boolean removeConnectedHost(RnibUe ue) {
-            List<RnibLink> links = xranStore.getLinksByUeId(ue.getId());
+            List<RnibLink> links = xranStore.getlinksbyueid(ue.getId());
             links.forEach(rnibLink -> xranStore.removeLink(rnibLink.getLinkId()));
             if (ueMap.remove(ue.getId())) {
                 for (XranHostListener l : xranHostListeners) {
@@ -595,465 +692,656 @@
 
     public class InternalXranPacketAgent implements XranPacketProcessor {
         @Override
-        public void handlePacket(XrancPdu recv_pdu, ChannelHandlerContext ctx) throws IOException, InterruptedException {
-            XrancPdu send_pdu;
+        public void handlePacket(XrancPdu recvPdu, ChannelHandlerContext ctx)
+                throws IOException, InterruptedException {
+            XrancPdu sendPdu;
 
-            int apiID = recv_pdu.getHdr().getApiId().intValue();
-            log.debug("Received message: {}", recv_pdu);
+            int apiID = recvPdu.getHdr().getApiId().intValue();
+            log.debug("Received message: {}", recvPdu);
             switch (apiID) {
                 case 1: {
                     // Decode Cell config report.
-                    CellConfigReport report = recv_pdu.getBody().getCellConfigReport();
-
-                    ECGI ecgi = report.getEcgi();
-
-                    RnibCell cell = xranStore.getCell(ecgi);
-                    cell.setVersion(recv_pdu.getHdr().getVer().toString());
-                    cell.setConf(report);
-                    cellMap.putPciArfcn(cell);
+                    CellConfigReport report = recvPdu.getBody().getCellConfigReport();
+                    handleCellconfigreport(report, recvPdu.getHdr().getVer().toString());
                     break;
                 }
                 case 2: {
                     // Decode UE Admission Request.
-                    UEAdmissionRequest ueAdmissionRequest = recv_pdu.getBody().getUEAdmissionRequest();
-
-                    ECGI ecgi = ueAdmissionRequest.getEcgi();
-                    if (xranStore.getCell(ecgi) != null) {
-                        CRNTI crnti = ueAdmissionRequest.getCrnti();
-                        send_pdu = UEAdmissionResponse.constructPacket(ecgi, crnti, xranConfig.admissionFlag());
-                        ctx.writeAndFlush(getSctpMessage(send_pdu));
-                    } else {
-                        log.warn("Could not find ECGI in registered cells: {}", ecgi);
-                    }
+                    UEAdmissionRequest ueAdmissionRequest = recvPdu.getBody().getUEAdmissionRequest();
+                    handleUeadmissionrequest(ueAdmissionRequest, ctx);
                     break;
                 }
                 case 4: {
                     // Decode UE Admission Status.
-                    UEAdmissionStatus ueAdmissionStatus = recv_pdu.getBody().getUEAdmissionStatus();
-
-                    RnibUe ue = ueMap.get(ueAdmissionStatus.getEcgi(), ueAdmissionStatus.getCrnti());
-                    if (ue != null) {
-                        if (ueAdmissionStatus.getAdmEstStatus().value.intValue() == 0) {
-                            ue.setState(RnibUe.State.ACTIVE);
-                        } else {
-                            ue.setState(RnibUe.State.IDLE);
-                        }
-                    }
-
-                    if (ueAdmissionStatus.getAdmEstStatus().value.intValue() == 0) {
-                        EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair.valueOf(ueAdmissionStatus.getEcgi(), ueAdmissionStatus.getCrnti());
-                        contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
-                            if (v == null) {
-                                v = new contextUpdateHandler();
-                            }
-                            if (v.setAdmissionStatus(ueAdmissionStatus)) {
-                                handleContextUpdate(v.getContextUpdate(), ctx, false);
-                            }
-                            return v;
-                        });
-                    }
+                    UEAdmissionStatus ueAdmissionStatus = recvPdu.getBody().getUEAdmissionStatus();
+                    handleAdmissionstatus(ueAdmissionStatus, ctx);
                     break;
                 }
                 case 5: {
                     // Decode UE Context Update.
-                    UEContextUpdate ueContextUpdate = recv_pdu.getBody().getUEContextUpdate();
-                    EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair.valueOf(ueContextUpdate.getEcgi(), ueContextUpdate.getCrnti());
-
-                    contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
-                        if (v == null) {
-                            v = new contextUpdateHandler();
-                        }
-                        if (v.setContextUpdate(ueContextUpdate)) {
-                            HOComplete hoComplete = v.getHoComplete();
-                            handleContextUpdate(ueContextUpdate, ctx, hoComplete != null);
-                            if (hoComplete != null) {
-                                try {
-                                    hoMap.get(hoComplete.getEcgiS()).put("Hand Over Completed");
-                                } catch (InterruptedException e) {
-                                    log.error(ExceptionUtils.getFullStackTrace(e));
-                                    e.printStackTrace();
-                                } finally {
-                                    hoMap.remove(hoComplete.getEcgiS());
-                                }
-                            }
-                        }
-                        return v;
-                    });
+                    UEContextUpdate ueContextUpdate = recvPdu.getBody().getUEContextUpdate();
+                    handleUecontextupdate(ueContextUpdate, ctx);
 
                     break;
                 }
                 case 6: {
                     // Decode UE Reconfig_Ind.
-                    UEReconfigInd ueReconfigInd = recv_pdu.getBody().getUEReconfigInd();
-                    RnibUe ue = ueMap.get(ueReconfigInd.getEcgi(), ueReconfigInd.getCrntiOld());
-
-                    if (ue != null) {
-                        ue.setCrnti(ueReconfigInd.getCrntiNew());
-                    } else {
-                        log.warn("Could not find UE with this CRNTI: {}", ueReconfigInd.getCrntiOld());
-                    }
+                    UEReconfigInd ueReconfigInd = recvPdu.getBody().getUEReconfigInd();
+                    handleUereconfigind(ueReconfigInd);
                     break;
                 }
                 case 7: {
                     // If xRANc wants to deactivate UE, we pass UEReleaseInd from xRANc to eNB.
                     // Decode UE Release_Ind.
-                    UEReleaseInd ueReleaseInd = recv_pdu.getBody().getUEReleaseInd();
-                    RnibUe ue = ueMap.get(ueReleaseInd.getEcgi(), ueReleaseInd.getCrnti());
-                    if (ue != null) {
-                        ue.setState(RnibUe.State.IDLE);
-                        restartTimer(ue);
-                    }
+                    UEReleaseInd ueReleaseInd = recvPdu.getBody().getUEReleaseInd();
+                    handleUereleaseind(ueReleaseInd);
                     break;
                 }
                 case 8: {
                     // Decode Bearer Adm Request
-                    BearerAdmissionRequest bearerAdmissionRequest = recv_pdu.getBody().getBearerAdmissionRequest();
-
-                    ECGI ecgi = bearerAdmissionRequest.getEcgi();
-                    CRNTI crnti = bearerAdmissionRequest.getCrnti();
-                    ERABParams erabParams = bearerAdmissionRequest.getErabParams();
-                    RnibLink link = linkMap.get(ecgi, crnti);
-                    if (link != null) {
-                        link.setBearerParameters(erabParams);
-                    } else {
-                        log.warn("Could not find link between {}-{}", ecgi, crnti);
-                    }
-
-                    BerInteger numErabs = bearerAdmissionRequest.getNumErabs();
-                    // Encode and send Bearer Admission Response
-                    send_pdu = BearerAdmissionResponse.constructPacket(ecgi, crnti, erabParams, numErabs, xranConfig.bearerFlag());
-                    ctx.writeAndFlush(getSctpMessage(send_pdu));
+                    BearerAdmissionRequest bearerAdmissionRequest = recvPdu.getBody().getBearerAdmissionRequest();
+                    handleBeareradmissionrequest(bearerAdmissionRequest, ctx);
                     break;
                 }
                 case 10: {
                     //Decode Bearer Admission Status
-                    BearerAdmissionStatus bearerAdmissionStatus = recv_pdu.getBody().getBearerAdmissionStatus();
+                    BearerAdmissionStatus bearerAdmissionStatus = recvPdu.getBody().getBearerAdmissionStatus();
                     break;
-//                    ECGI ecgi = bearerAdmissionStatus.getEcgi();
-//                    CRNTI crnti = bearerAdmissionStatus.getCrnti();
-//
-//                    RnibLink link = linkMap.get(ecgi, crnti);
                 }
                 case 11: {
                     //Decode Bearer Release Ind
-                    BearerReleaseInd bearerReleaseInd = recv_pdu.getBody().getBearerReleaseInd();
-
-                    ECGI ecgi = bearerReleaseInd.getEcgi();
-                    CRNTI crnti = bearerReleaseInd.getCrnti();
-                    RnibLink link = linkMap.get(ecgi, crnti);
-
-                    List<ERABID> erabidsRelease = bearerReleaseInd.getErabIds().getERABID();
-                    List<ERABParamsItem> erabParamsItem = link.getBearerParameters().getERABParamsItem();
-
-                    List<ERABParamsItem> unreleased = erabParamsItem
-                            .stream()
-                            .filter(item -> {
-                                Optional<ERABID> any = erabidsRelease.stream().filter(id -> id.equals(item.getId())).findAny();
-                                return !any.isPresent();
-                            }).collect(Collectors.toList());
-
-                    link.getBearerParameters().setERABParamsItem(new ArrayList<>(unreleased));
+                    BearerReleaseInd bearerReleaseInd = recvPdu.getBody().getBearerReleaseInd();
+                    handleBearerreleaseind(bearerReleaseInd);
                     break;
                 }
                 case 13: {
-                    HOFailure hoFailure = recv_pdu.getBody().getHOFailure();
-
-                    try {
-                        hoMap.get(hoFailure.getEcgi())
-                                .put("Hand Over Failed with cause: " + hoFailure.getCause());
-                    } catch (InterruptedException e) {
-                        log.error(ExceptionUtils.getFullStackTrace(e));
-                        e.printStackTrace();
-                    } finally {
-                        hoMap.remove(hoFailure.getEcgi());
-                        ueIdQueue.take();
-                    }
+                    HOFailure hoFailure = recvPdu.getBody().getHOFailure();
+                    handleHofailure(hoFailure);
                     break;
 
                 }
                 case 14: {
-                    HOComplete hoComplete = recv_pdu.getBody().getHOComplete();
-
-                    EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair.valueOf(hoComplete.getEcgiT(), hoComplete.getCrntiNew());
-                    contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
-                        if (v == null) {
-                            v = new contextUpdateHandler();
-                        }
-                        if (v.setHoComplete(hoComplete)) {
-                            handleContextUpdate(v.getContextUpdate(), ctx, true);
-
-                            try {
-                                hoMap.get(hoComplete.getEcgiS()).put("Hand Over Completed");
-                            } catch (InterruptedException e) {
-                                log.error(ExceptionUtils.getFullStackTrace(e));
-                                e.printStackTrace();
-                            } finally {
-                                hoMap.remove(hoComplete.getEcgiS());
-                            }
-                        }
-                        return v;
-                    });
-
+                    HOComplete hoComplete = recvPdu.getBody().getHOComplete();
+                    handleHocomplete(hoComplete, ctx);
                     break;
                 }
 
                 case 16: {
-                    // Decode RX Sig Meas Report.
-                    RXSigMeasReport rxSigMeasReport = recv_pdu.getBody().getRXSigMeasReport();
-                    List<RXSigReport> rxSigReportList = rxSigMeasReport.getCellMeasReports().getRXSigReport();
-
-                    RnibUe ue = ueMap.get(rxSigMeasReport.getEcgi(), rxSigMeasReport.getCrnti());
-                    if (ue != null) {
-                        Long ueId = ue.getId();
-
-                        if (!rxSigReportList.isEmpty()) {
-                            rxSigReportList.forEach(rxSigReport -> {
-                                RnibCell cell = cellMap.get(rxSigReport.getPciArfcn());
-                                if (cell != null) {
-                                    ECGI ecgi = cell.getEcgi();
-
-                                    RnibLink link = linkMap.get(ecgi, ueId);
-                                    if (link == null) {
-                                        log.warn("Could not find link between: {}-{} | Creating non-serving link..", ecgi, ueId);
-                                        link = linkMap.putNonServingLink(cell, ueId);
-                                    }
-
-                                    if (link != null) {
-                                        if (link.getType().equals(RnibLink.Type.NON_SERVING)) {
-                                            restartTimer(link);
-                                        }
-
-                                        RSRQRange rsrq = rxSigReport.getRsrq();
-                                        RSRPRange rsrp = rxSigReport.getRsrp();
-
-                                        RnibLink.LinkQuality quality = link.getQuality();
-                                        quality.setRX(new RnibLink.LinkQuality.RX(
-                                                rsrp.value.intValue() - 140,
-                                                (rsrq.value.intValue() * 0.5) - 19.5
-                                        ));
-                                    }
-                                } else {
-                                    log.warn("case 16: Could not find cell with PCI-ARFCN: {}", rxSigReport.getPciArfcn());
-                                }
-                            });
-                        }
-                    }
+                    // Decode Rx Sig Meas Report.
+                    RXSigMeasReport rxSigMeasReport = recvPdu.getBody().getRXSigMeasReport();
+                    handleRxsigmeasreport(rxSigMeasReport);
                     break;
                 }
                 case 18: {
-                    RadioMeasReportPerUE radioMeasReportPerUE = recv_pdu.getBody().getRadioMeasReportPerUE();
-
-                    RnibUe ue = ueMap.get(radioMeasReportPerUE.getEcgi(), radioMeasReportPerUE.getCrnti());
-                    if (ue != null) {
-                        Long ueId = ue.getId();
-                        List<RadioRepPerServCell> servCells = radioMeasReportPerUE.getRadioReportServCells().getRadioRepPerServCell();
-
-                        servCells.forEach(servCell -> {
-                            RnibCell cell = cellMap.get(servCell.getPciArfcn());
-                            if (cell != null) {
-                                RnibLink link = linkMap.get(cell.getEcgi(), ueId);
-                                if (link != null) {
-                                    RadioRepPerServCell.CqiHist cqiHist = servCell.getCqiHist();
-                                    RnibLink.LinkQuality quality = link.getQuality();
-
-                                    final double[] values = {0, 0, 0};
-                                    final int[] i = {1};
-                                    cqiHist.getBerInteger().forEach(value -> {
-                                        values[0] = Math.max(values[0], value.intValue());
-                                        values[1] += i[0] * value.intValue();
-                                        values[2] += value.intValue();
-                                        i[0]++;
-                                    });
-
-                                    quality.setCQI(new RnibLink.LinkQuality.CQI(
-                                            cqiHist,
-                                            values[0],
-                                            values[1] / values[0]
-                                    ));
-
-                                } else {
-                                    log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
-                                }
-                            } else {
-                                log.warn("case 18: Could not find cell with PCI-ARFCN: {}", servCell.getPciArfcn());
-                            }
-                        });
-                    }
+                    RadioMeasReportPerUE radioMeasReportPerUE = recvPdu.getBody().getRadioMeasReportPerUE();
+                    handleRadionmeasreportperue(radioMeasReportPerUE);
                     break;
                 }
                 case 19: {
-                    RadioMeasReportPerCell radioMeasReportPerCell = recv_pdu.getBody().getRadioMeasReportPerCell();
+                    RadioMeasReportPerCell radioMeasReportPerCell = recvPdu.getBody().getRadioMeasReportPerCell();
                     break;
                 }
                 case 20: {
-                    SchedMeasReportPerUE schedMeasReportPerUE = recv_pdu.getBody().getSchedMeasReportPerUE();
-
-                    RnibUe ue = ueMap.get(schedMeasReportPerUE.getEcgi(), schedMeasReportPerUE.getCrnti());
-                    if (ue != null) {
-                        Long ueId = ue.getId();
-
-                        List<SchedMeasRepPerServCell> servCells = schedMeasReportPerUE.getSchedReportServCells()
-                                .getSchedMeasRepPerServCell();
-
-                        servCells.forEach(servCell -> {
-                            RnibCell cell = cellMap.get(servCell.getPciArfcn());
-                            if (cell != null) {
-                                RnibLink link = linkMap.get(cell.getEcgi(), ueId);
-                                if (link != null) {
-                                    link.getQuality().setMCS(new RnibLink.LinkQuality.MCS(
-                                            servCell.getMcsDl(),
-                                            servCell.getMcsUl()
-                                    ));
-
-                                    link.setResourceUsage(new RnibLink.ResourceUsage(
-                                            servCell.getPrbUsage().getPrbUsageDl(),
-                                            servCell.getPrbUsage().getPrbUsageUl()
-                                    ));
-                                } else {
-                                    log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
-                                }
-                            } else {
-                                log.warn("case 20: Could not find cell with PCI-ARFCN: {}", servCell.getPciArfcn());
-                            }
-                        });
-                    }
+                    SchedMeasReportPerUE schedMeasReportPerUE = recvPdu.getBody().getSchedMeasReportPerUE();
+                    handleSchedmeasreportperue(schedMeasReportPerUE);
                     break;
                 }
                 case 21: {
-                    SchedMeasReportPerCell schedMeasReportPerCell = recv_pdu.getBody().getSchedMeasReportPerCell();
-                    RnibCell cell = cellMap.get(schedMeasReportPerCell.getEcgi());
-                    if (cell != null) {
-                        cell.setPrbUsage(new RnibCell.PrbUsageContainer(
-                                schedMeasReportPerCell.getPrbUsagePcell(),
-                                schedMeasReportPerCell.getPrbUsageScell()
-                        ));
-
-                        cell.setQci(schedMeasReportPerCell.getQciVals());
-                    } else {
-                        log.warn("Could not find cell with ECGI: {}", schedMeasReportPerCell.getEcgi());
-                    }
+                    SchedMeasReportPerCell schedMeasReportPerCell = recvPdu.getBody().getSchedMeasReportPerCell();
+                    handleSchedmeasreportpercell(schedMeasReportPerCell);
                     break;
                 }
                 case 22: {
-                    PDCPMeasReportPerUe pdcpMeasReportPerUe = recv_pdu.getBody().getPDCPMeasReportPerUe();
-
-                    RnibUe ue = ueMap.get(pdcpMeasReportPerUe.getEcgi(), pdcpMeasReportPerUe.getCrnti());
-                    if (ue != null) {
-                        Long ueId = ue.getId();
-                        RnibLink link = linkMap.get(pdcpMeasReportPerUe.getEcgi(), ueId);
-                        if (link != null) {
-                            link.setPdcpThroughput(new RnibLink.PDCPThroughput(
-                                    pdcpMeasReportPerUe.getThroughputDl(),
-                                    pdcpMeasReportPerUe.getThroughputUl()
-                            ));
-
-                            link.setPdcpPackDelay(new RnibLink.PDCPPacketDelay(
-                                    pdcpMeasReportPerUe.getPktDelayDl(),
-                                    pdcpMeasReportPerUe.getPktDelayUl()
-                            ));
-                        } else {
-                            log.warn("Could not find link between: {}-{}", pdcpMeasReportPerUe.getEcgi(), ueId);
-                        }
-                    }
+                    PDCPMeasReportPerUe pdcpMeasReportPerUe = recvPdu.getBody().getPDCPMeasReportPerUe();
+                    handlePdcpmeasreportperue(pdcpMeasReportPerUe);
                     break;
                 }
                 case 24: {
                     // Decode UE Capability Info
-                    UECapabilityInfo capabilityInfo = recv_pdu.getBody().getUECapabilityInfo();
-
-                    RnibUe ue = ueMap.get(capabilityInfo.getEcgi(), capabilityInfo.getCrnti());
-                    if (ue != null) {
-                        ue.setCapability(capabilityInfo);
-                    } else {
-                        log.warn("Could not find UE with this CRNTI: {}", capabilityInfo.getCrnti());
-                    }
+                    UECapabilityInfo capabilityInfo = recvPdu.getBody().getUECapabilityInfo();
+                    handleCapabilityinfo(capabilityInfo);
                     break;
                 }
                 case 25: {
                     // Don't know what will invoke sending UE CAPABILITY ENQUIRY
                     // Encode and send UE CAPABILITY ENQUIRY
-                    UECapabilityEnquiry ueCapabilityEnquiry = recv_pdu.getBody().getUECapabilityEnquiry();
-                    XrancPdu xrancPdu = UECapabilityEnquiry.constructPacket(ueCapabilityEnquiry.getEcgi(), ueCapabilityEnquiry.getCrnti());
-                    ctx.writeAndFlush(getSctpMessage(xrancPdu));
+                    UECapabilityEnquiry ueCapabilityEnquiry = recvPdu.getBody().getUECapabilityEnquiry();
+                    handleUecapabilityenquiry(ueCapabilityEnquiry, ctx);
                     break;
                 }
                 case 27: {
                     //Decode ScellAddStatus
-                    ScellAddStatus scellAddStatus = recv_pdu.getBody().getScellAddStatus();
-                    RnibUe ue = ueMap.get(scellAddStatus.getEcgi(), scellAddStatus.getCrnti());
-                    if (ue != null) {
-                        Long ueId = ue.getId();
-                        try {
-                            scellAddMap.get(scellAddStatus.getCrnti()).put("Scell's status: " + scellAddStatus.getStatus());
-                            if (scellAddStatus.getStatus().getBerEnum().get(0).value.intValue() == 0) {
-
-                                scellAddStatus.getScellsInd().getPCIARFCN().forEach(
-                                        pciarfcn -> {
-                                            RnibCell cell = cellMap.get(pciarfcn);
-                                            RnibLink link = linkMap.get(cell.getEcgi(), ueId);
-                                            link.setType(RnibLink.Type.SERVING_SECONDARY_CA);
-                                        }
-                                );
-                            } else {
-                                log.error("Scell addition failed.");
-                            }
-                        } catch (InterruptedException e) {
-                            log.error(ExceptionUtils.getFullStackTrace(e));
-                            e.printStackTrace();
-                        } finally {
-                            scellAddMap.remove(scellAddStatus.getCrnti());
-                        }
-                    }
+                    ScellAddStatus scellAddStatus = recvPdu.getBody().getScellAddStatus();
+                    handleScelladdstatus(scellAddStatus);
                     break;
                 }
-                // TODO: 28: ScellDelete
                 case 30: {
                     // Decode RRMConfig Status
-                    RRMConfigStatus rrmConfigStatus = recv_pdu.getBody().getRRMConfigStatus();
-                    try {
-                        RRMCellMap.get(rrmConfigStatus.getEcgi())
-                                .put("RRM Config's status: " + rrmConfigStatus.getStatus());
-                    } catch (InterruptedException e) {
-                        log.error(ExceptionUtils.getFullStackTrace(e));
-                        e.printStackTrace();
-                    } finally {
-                        RRMCellMap.remove(rrmConfigStatus.getEcgi());
-                    }
+                    RRMConfigStatus rrmConfigStatus = recvPdu.getBody().getRRMConfigStatus();
+                    handleRrmconfigstatus(rrmConfigStatus);
                     break;
                 }
                 //TODO Case 31: SeNBAdd 32: SeNBAddStatus 33: SeNBDelete
                 case 34: {
-                    TrafficSplitConfig trafficSplitConfig = recv_pdu.getBody().getTrafficSplitConfig();
-
-                    RnibUe ue = ueMap.get(trafficSplitConfig.getEcgi(), trafficSplitConfig.getCrnti());
-                    if (ue != null) {
-                        Long ueId = ue.getId();
-                        List<TrafficSplitPercentage> splitPercentages = trafficSplitConfig.getTrafficSplitPercent().getTrafficSplitPercentage();
-
-                        splitPercentages.forEach(trafficSplitPercentage -> {
-                            RnibCell cell = cellMap.get(trafficSplitPercentage.getEcgi());
-                            if (cell != null) {
-                                RnibLink link = linkMap.get(cell.getEcgi(), ueId);
-                                if (link != null) {
-                                    link.setTrafficPercent(trafficSplitPercentage);
-                                } else {
-                                    log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
-                                }
-                            } else {
-                                log.warn("Could not find cell with ECGI: {}", trafficSplitConfig.getEcgi());
-                            }
-                        });
-                    }
+                    TrafficSplitConfig trafficSplitConfig = recvPdu.getBody().getTrafficSplitConfig();
+                    handleTrafficSplitConfig(trafficSplitConfig);
                     break;
                 }
                 default: {
-                    log.warn("Wrong API ID: {}", recv_pdu);
+                    log.warn("Wrong API ID: {}", recvPdu);
                     break;
                 }
             }
 
         }
 
+        /**
+         * Handle Cellconfigreport.
+         * @param report CellConfigReport
+         * @param version String version ID
+         */
+        private void handleCellconfigreport(CellConfigReport report, String version) {
+            ECGI ecgi = report.getEcgi();
+
+            RnibCell cell = xranStore.getCell(ecgi);
+            cell.setVersion(version);
+            cell.setConf(report);
+            cellMap.putPciArfcn(cell);
+        }
+
+        /**
+         * Handle Ueadmissionrequest.
+         * @param ueAdmissionRequest UEAdmissionRequest
+         * @param ctx ChannelHandlerContext
+         * @throws IOException IO Exception
+         */
+        private void handleUeadmissionrequest(UEAdmissionRequest ueAdmissionRequest, ChannelHandlerContext ctx)
+                throws IOException {
+            ECGI ecgi = ueAdmissionRequest.getEcgi();
+            if (xranStore.getCell(ecgi) != null) {
+                CRNTI crnti = ueAdmissionRequest.getCrnti();
+                XrancPdu sendPdu = UEAdmissionResponse.constructPacket(ecgi, crnti, xranConfig.admissionFlag());
+                ctx.writeAndFlush(getSctpMessage(sendPdu));
+            } else {
+                log.warn("Could not find ECGI in registered cells: {}", ecgi);
+            }
+        }
+
+        /**
+         * Handle UEAdmissionStatus.
+         * @param ueAdmissionStatus UEAdmissionStatus
+         * @param ctx ChannelHandlerContext
+         */
+        private void handleAdmissionstatus(UEAdmissionStatus ueAdmissionStatus, ChannelHandlerContext ctx) {
+            RnibUe ue = ueMap.get(ueAdmissionStatus.getEcgi(), ueAdmissionStatus.getCrnti());
+            if (ue != null) {
+                if (ueAdmissionStatus.getAdmEstStatus().value.intValue() == 0) {
+                    ue.setState(RnibUe.State.ACTIVE);
+                } else {
+                    ue.setState(RnibUe.State.IDLE);
+                }
+            }
+
+            if (ueAdmissionStatus.getAdmEstStatus().value.intValue() == 0) {
+                EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair
+                        .valueOf(ueAdmissionStatus.getEcgi(), ueAdmissionStatus.getCrnti());
+                contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
+                    if (v == null) {
+                        v = new ContextUpdateHandler();
+                    }
+                    if (v.setAdmissionStatus(ueAdmissionStatus)) {
+                        handleContextUpdate(v.getContextUpdate(), ctx, false);
+                    }
+                    return v;
+                });
+            }
+        }
+
+        /**
+         * Handle UEContextUpdate.
+         * @param ueContextUpdate UEContextUpdate
+         * @param ctx ChannelHandlerContext
+         */
+        private void handleUecontextupdate(UEContextUpdate ueContextUpdate, ChannelHandlerContext ctx) {
+            EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair
+                    .valueOf(ueContextUpdate.getEcgi(), ueContextUpdate.getCrnti());
+
+            contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
+                if (v == null) {
+                    v = new ContextUpdateHandler();
+                }
+                if (v.setContextUpdate(ueContextUpdate)) {
+                    HOComplete hoComplete = v.getHoComplete();
+                    handleContextUpdate(ueContextUpdate, ctx, hoComplete != null);
+                    if (hoComplete != null) {
+                        try {
+                            hoMap.get(hoComplete.getEcgiS()).put("Hand Over Completed");
+                        } catch (InterruptedException e) {
+                            log.error(ExceptionUtils.getFullStackTrace(e));
+                            e.printStackTrace();
+                        } finally {
+                            hoMap.remove(hoComplete.getEcgiS());
+                        }
+                    }
+                }
+                return v;
+            });
+        }
+
+        /**
+         * Handle UEReconfigInd.
+         * @param ueReconfigInd UEReconfigInd
+         */
+        private void handleUereconfigind(UEReconfigInd ueReconfigInd) {
+            RnibUe ue = ueMap.get(ueReconfigInd.getEcgi(), ueReconfigInd.getCrntiOld());
+            RnibCell cell = cellMap.get(ueReconfigInd.getEcgi());
+
+            if (ue != null && cell != null) {
+                ue.setCrnti(ueReconfigInd.getCrntiNew());
+                ueMap.putCrnti(cell, ue);
+            } else {
+                log.warn("Could not find UE with this CRNTI: {}", ueReconfigInd.getCrntiOld());
+            }
+        }
+
+        /**
+         * Handle UEReleaseInd.
+         * @param ueReleaseInd UEReleaseInd
+         */
+        private void handleUereleaseind(UEReleaseInd ueReleaseInd) {
+            ECGI ecgi = ueReleaseInd.getEcgi();
+            CRNTI crnti = ueReleaseInd.getCrnti();
+            RnibUe ue = ueMap.get(ecgi, crnti);
+
+            // Check if there is an ongoing handoff and only remove if ue is not part of the handoff.
+            Long peek = ueIdQueue.peek();
+            if (peek != null) {
+                EcgiCrntiPair ecgiCrntiPair = ueMap.getCrntUe().inverse().get(peek);
+                if (ecgiCrntiPair != null && ecgiCrntiPair.equals(EcgiCrntiPair.valueOf(ecgi, crnti))) {
+                    return;
+                }
+            }
+
+            if (ue != null) {
+                ue.setState(RnibUe.State.IDLE);
+                restartTimer(ue);
+            } else {
+                log.warn("Cannot release UE from non primary link.");
+            }
+        }
+
+        /**
+         * Handle BearerAdmissionRequest.
+         * @param bearerAdmissionRequest BearerAdmissionRequest
+         * @param ctx ChannelHandlerContext
+         * @throws IOException IO Exception
+         */
+        private void handleBeareradmissionrequest(BearerAdmissionRequest bearerAdmissionRequest,
+                                                  ChannelHandlerContext ctx) throws IOException {
+            ECGI ecgi = bearerAdmissionRequest.getEcgi();
+            CRNTI crnti = bearerAdmissionRequest.getCrnti();
+            ERABParams erabParams = bearerAdmissionRequest.getErabParams();
+            RnibLink link = linkMap.get(ecgi, crnti);
+            if (link != null) {
+                link.setBearerParameters(erabParams);
+            } else {
+                log.warn("Could not find link between {}-{}", ecgi, crnti);
+            }
+
+            BerInteger numErabs = bearerAdmissionRequest.getNumErabs();
+            // Encode and send Bearer Admission Response
+            XrancPdu sendPdu = BearerAdmissionResponse
+                    .constructPacket(ecgi, crnti, erabParams, numErabs, xranConfig.bearerFlag());
+            ctx.writeAndFlush(getSctpMessage(sendPdu));
+        }
+
+        /**
+         * Handle BearerReleaseInd.
+         * @param bearerReleaseInd
+         */
+        private void handleBearerreleaseind(BearerReleaseInd bearerReleaseInd) {
+            ECGI ecgi = bearerReleaseInd.getEcgi();
+            CRNTI crnti = bearerReleaseInd.getCrnti();
+            RnibLink link = linkMap.get(ecgi, crnti);
+
+            List<ERABID> erabidsRelease = bearerReleaseInd.getErabIds().getERABID();
+            List<ERABParamsItem> erabParamsItem = link.getBearerParameters().getERABParamsItem();
+
+            List<ERABParamsItem> unreleased = erabParamsItem
+                    .stream()
+                    .filter(item -> {
+                        Optional<ERABID> any = erabidsRelease.stream()
+                                .filter(id -> id.equals(item.getId())).findAny();
+                        return !any.isPresent();
+                    }).collect(Collectors.toList());
+
+            link.getBearerParameters().setERABParamsItem(new ArrayList<>(unreleased));
+        }
+
+        /**
+         * Handle HOFailure.
+         * @param hoFailure HOFailure
+         * @throws InterruptedException ueIdQueue interruption
+         */
+        private void handleHofailure(HOFailure hoFailure) throws InterruptedException {
+            try {
+                hoMap.get(hoFailure.getEcgi())
+                        .put("Hand Over Failed with cause: " + hoFailure.getCause());
+            } catch (InterruptedException e) {
+                log.error(ExceptionUtils.getFullStackTrace(e));
+                e.printStackTrace();
+            } finally {
+                hoMap.remove(hoFailure.getEcgi());
+                ueIdQueue.take();
+            }
+        }
+
+        /**
+         * Handle HOComplete.
+         * @param hoComplete HOComplete
+         * @param ctx ChannelHandlerContext
+         */
+        private void handleHocomplete(HOComplete hoComplete, ChannelHandlerContext ctx) {
+            EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair.valueOf(hoComplete.getEcgiT(),
+                    hoComplete.getCrntiNew());
+            contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
+                if (v == null) {
+                    v = new ContextUpdateHandler();
+                }
+                if (v.setHoComplete(hoComplete)) {
+                    handleContextUpdate(v.getContextUpdate(), ctx, true);
+
+                    try {
+                        hoMap.get(hoComplete.getEcgiS()).put("Hand Over Completed");
+                    } catch (InterruptedException e) {
+                        log.error(ExceptionUtils.getFullStackTrace(e));
+                        e.printStackTrace();
+                    } finally {
+                        hoMap.remove(hoComplete.getEcgiS());
+                    }
+                }
+                return v;
+            });
+        }
+
+        /**
+         * Handle RXSigMeasReport.
+         * @param rxSigMeasReport RXSigMeasReport
+         */
+        private void handleRxsigmeasreport(RXSigMeasReport rxSigMeasReport) {
+            List<RXSigReport> rxSigReportList = rxSigMeasReport.getCellMeasReports().getRXSigReport();
+
+            RnibUe ue = ueMap.get(rxSigMeasReport.getEcgi(), rxSigMeasReport.getCrnti());
+            if (ue != null) {
+                Long ueId = ue.getId();
+
+                if (!rxSigReportList.isEmpty()) {
+                    rxSigReportList.forEach(rxSigReport -> {
+                        RnibCell cell = cellMap.get(rxSigReport.getPciArfcn());
+                        if (cell != null) {
+                            ECGI ecgi = cell.getEcgi();
+
+                            RnibLink link = linkMap.get(ecgi, ueId);
+                            if (link == null) {
+                                log.warn("Could not find link between: {}-{} | Creating non-serving link..",
+                                        ecgi, ueId);
+                                link = linkMap.putNonServingLink(cell, ueId);
+                            }
+
+                            if (link != null) {
+                                if (link.getType().equals(RnibLink.Type.NON_SERVING)) {
+                                    restartTimer(link);
+                                }
+
+                                RSRQRange rsrq = rxSigReport.getRsrq();
+                                RSRPRange rsrp = rxSigReport.getRsrp();
+
+                                RnibLink.LinkQuality quality = link.getQuality();
+                                quality.setRx(new RnibLink.LinkQuality.Rx(
+                                        rsrp.value.intValue() - 140,
+                                        (rsrq.value.intValue() * 0.5) - 19.5
+                                ));
+                            }
+                        } else {
+                            log.warn("case 16: Could not find cell with PCI-ARFCN: {}",
+                                    rxSigReport.getPciArfcn());
+                        }
+                    });
+                }
+            }
+        }
+
+        /**
+         * Handle RadioMeasReportPerUE.
+         * @param radioMeasReportPerUE RadioMeasReportPerUE
+         */
+        private void handleRadionmeasreportperue(RadioMeasReportPerUE radioMeasReportPerUE) {
+            RnibUe ue = ueMap.get(radioMeasReportPerUE.getEcgi(), radioMeasReportPerUE.getCrnti());
+            if (ue != null) {
+                Long ueId = ue.getId();
+                List<RadioRepPerServCell> servCells = radioMeasReportPerUE.getRadioReportServCells()
+                        .getRadioRepPerServCell();
+
+                servCells.forEach(servCell -> {
+                    RnibCell cell = cellMap.get(servCell.getPciArfcn());
+                    if (cell != null) {
+                        RnibLink link = linkMap.get(cell.getEcgi(), ueId);
+                        if (link != null) {
+                            RadioRepPerServCell.CqiHist cqiHist = servCell.getCqiHist();
+                            RnibLink.LinkQuality quality = link.getQuality();
+
+                            final double[] values = {0, 0, 0};
+                            final int[] i = {1};
+                            cqiHist.getBerInteger().forEach(value -> {
+                                values[0] = Math.max(values[0], value.intValue());
+                                values[1] += i[0] * value.intValue();
+                                values[2] += value.intValue();
+                                i[0]++;
+                            });
+
+                            quality.setCqi(new RnibLink.LinkQuality.Cqi(
+                                    cqiHist,
+                                    values[0],
+                                    values[1] / values[0]
+                            ));
+
+                        } else {
+                            log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
+                        }
+                    } else {
+                        log.warn("case 18: Could not find cell with PCI-ARFCN: {}", servCell.getPciArfcn());
+                    }
+                });
+            }
+        }
+
+        /**
+         * Handle SchedMeasReportPerUE.
+         * @param schedMeasReportPerUE SchedMeasReportPerUE
+         */
+        private void handleSchedmeasreportperue(SchedMeasReportPerUE schedMeasReportPerUE) {
+            RnibUe ue = ueMap.get(schedMeasReportPerUE.getEcgi(), schedMeasReportPerUE.getCrnti());
+            if (ue != null) {
+                Long ueId = ue.getId();
+
+                List<SchedMeasRepPerServCell> servCells = schedMeasReportPerUE.getSchedReportServCells()
+                        .getSchedMeasRepPerServCell();
+
+                servCells.forEach(servCell -> {
+                    RnibCell cell = cellMap.get(servCell.getPciArfcn());
+                    if (cell != null) {
+                        RnibLink link = linkMap.get(cell.getEcgi(), ueId);
+                        if (link != null) {
+                            link.getQuality().setMcs(new RnibLink.LinkQuality.Mcs(
+                                    servCell.getMcsDl(),
+                                    servCell.getMcsUl()
+                            ));
+
+                            link.setResourceUsage(new RnibLink.ResourceUsage(
+                                    servCell.getPrbUsage().getPrbUsageDl(),
+                                    servCell.getPrbUsage().getPrbUsageUl()
+                            ));
+                        } else {
+                            log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
+                        }
+                    } else {
+                        log.warn("case 20: Could not find cell with PCI-ARFCN: {}", servCell.getPciArfcn());
+                    }
+                });
+            }
+        }
+
+        /**
+         * Handle SchedMeasReportPerCell.
+         * @param schedMeasReportPerCell SchedMeasReportPerCell
+         */
+        private void handleSchedmeasreportpercell(SchedMeasReportPerCell schedMeasReportPerCell) {
+            RnibCell cell = cellMap.get(schedMeasReportPerCell.getEcgi());
+            if (cell != null) {
+                cell.setPrbUsage(new RnibCell.PrbUsageContainer(
+                        schedMeasReportPerCell.getPrbUsagePcell(),
+                        schedMeasReportPerCell.getPrbUsageScell()
+                ));
+
+                cell.setQci(schedMeasReportPerCell.getQciVals());
+            } else {
+                log.warn("Could not find cell with ECGI: {}", schedMeasReportPerCell.getEcgi());
+            }
+        }
+
+        /**
+         * Handle PDCPMeasReportPerUe.
+         * @param pdcpMeasReportPerUe PDCPMeasReportPerUe
+         */
+        private void handlePdcpmeasreportperue(PDCPMeasReportPerUe pdcpMeasReportPerUe) {
+            RnibUe ue = ueMap.get(pdcpMeasReportPerUe.getEcgi(), pdcpMeasReportPerUe.getCrnti());
+            if (ue != null) {
+                Long ueId = ue.getId();
+                RnibLink link = linkMap.get(pdcpMeasReportPerUe.getEcgi(), ueId);
+                if (link != null) {
+                    link.setPdcpThroughput(new RnibLink.PdcpThroughput(
+                            pdcpMeasReportPerUe.getThroughputDl(),
+                            pdcpMeasReportPerUe.getThroughputUl()
+                    ));
+
+                    link.setPdcpPackDelay(new RnibLink.PdcpPacketdelay(
+                            pdcpMeasReportPerUe.getPktDelayDl(),
+                            pdcpMeasReportPerUe.getPktDelayUl()
+                    ));
+                } else {
+                    log.warn("Could not find link between: {}-{}", pdcpMeasReportPerUe.getEcgi(), ueId);
+                }
+            }
+        }
+
+        /**
+         * Handle UECapabilityInfo.
+         * @param capabilityInfo UECapabilityInfo
+         */
+        private void handleCapabilityinfo(UECapabilityInfo capabilityInfo) {
+            RnibUe ue = ueMap.get(capabilityInfo.getEcgi(), capabilityInfo.getCrnti());
+            if (ue != null) {
+                ue.setCapability(capabilityInfo);
+            } else {
+                log.warn("Could not find UE with this CRNTI: {}", capabilityInfo.getCrnti());
+            }
+        }
+
+        /**
+         * Handle UECapabilityEnquiry.
+         * @param ueCapabilityEnquiry UECapabilityEnquiry
+         * @param ctx ChannelHandlerContext
+         * @throws IOException IO Exception
+         */
+        private void handleUecapabilityenquiry(UECapabilityEnquiry ueCapabilityEnquiry, ChannelHandlerContext ctx)
+                throws IOException {
+            XrancPdu xrancPdu = UECapabilityEnquiry.constructPacket(ueCapabilityEnquiry.getEcgi(),
+                    ueCapabilityEnquiry.getCrnti());
+            ctx.writeAndFlush(getSctpMessage(xrancPdu));
+        }
+
+        /**
+         * Handle ScellAddStatus.
+         * @param scellAddStatus ScellAddStatus
+         */
+        private void handleScelladdstatus(ScellAddStatus scellAddStatus) {
+            RnibUe ue = ueMap.get(scellAddStatus.getEcgi(), scellAddStatus.getCrnti());
+            if (ue != null) {
+                Long ueId = ue.getId();
+                try {
+                    scellAddMap.get(scellAddStatus.getCrnti()).put("Scell's status: " +
+                            scellAddStatus.getStatus());
+                    final int[] i = {0};
+                    scellAddStatus.getScellsInd().getPCIARFCN().forEach(
+                            pciarfcn -> {
+                                if (scellAddStatus.getStatus().getBerEnum().get(i[0]).value.intValue() == 0) {
+                                    RnibCell cell = cellMap.get(pciarfcn);
+                                    RnibLink link = linkMap.get(cell.getEcgi(), ueId);
+                                    link.setType(RnibLink.Type.SERVING_SECONDARY_CA);
+                                }
+                                i[0]++;
+                            }
+                    );
+
+                } catch (InterruptedException e) {
+                    log.error(ExceptionUtils.getFullStackTrace(e));
+                    e.printStackTrace();
+                } finally {
+                    scellAddMap.remove(scellAddStatus.getCrnti());
+                }
+            }
+        }
+
+        /**
+         * Handle RRMConfigStatus.
+         * @param rrmConfigStatus RRMConfigStatus
+         */
+        private void handleRrmconfigstatus(RRMConfigStatus rrmConfigStatus) {
+            try {
+                rrmcellMap.get(rrmConfigStatus.getEcgi())
+                        .put("RRM Config's status: " + rrmConfigStatus.getStatus());
+            } catch (InterruptedException e) {
+                log.error(ExceptionUtils.getFullStackTrace(e));
+                e.printStackTrace();
+            } finally {
+                rrmcellMap.remove(rrmConfigStatus.getEcgi());
+            }
+        }
+
+        /**
+         * Handle TrafficSplitConfig.
+         * @param trafficSplitConfig TrafficSplitConfig
+         */
+        private void handleTrafficSplitConfig(TrafficSplitConfig trafficSplitConfig) {
+            RnibUe ue = ueMap.get(trafficSplitConfig.getEcgi(), trafficSplitConfig.getCrnti());
+            if (ue != null) {
+                Long ueId = ue.getId();
+                List<TrafficSplitPercentage> splitPercentages = trafficSplitConfig
+                        .getTrafficSplitPercent().getTrafficSplitPercentage();
+
+                splitPercentages.forEach(trafficSplitPercentage -> {
+                    RnibCell cell = cellMap.get(trafficSplitPercentage.getEcgi());
+                    if (cell != null) {
+                        RnibLink link = linkMap.get(cell.getEcgi(), ueId);
+                        if (link != null) {
+                            link.setTrafficPercent(trafficSplitPercentage);
+                        } else {
+                            log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
+                        }
+                    } else {
+                        log.warn("Could not find cell with ECGI: {}", trafficSplitConfig.getEcgi());
+                    }
+                });
+            }
+        }
+
+        /**
+         * Handle context update depending if its handoff or not.
+         *
+         * @param contextUpdate context update packet
+         * @param ctx           channel context for the CELL
+         * @param handoff       true if we handle a Hand Off
+         */
         private void handleContextUpdate(UEContextUpdate contextUpdate, ChannelHandlerContext ctx, boolean handoff) {
             RnibUe ue;
             RnibCell cell = xranStore.getCell(contextUpdate.getEcgi());
@@ -1078,6 +1366,9 @@
         }
     }
 
+    /**
+     * Internal class for NetworkConfigListener.
+     */
     class InternalNetworkConfigListener implements NetworkConfigListener {
 
         @Override
@@ -1100,6 +1391,11 @@
             }
         }
 
+        /**
+         * Handle config event.
+         *
+         * @param config
+         */
         private void handleConfigEvent(Optional<Config> config) {
             if (!config.isPresent()) {
                 return;
@@ -1107,7 +1403,7 @@
 
             xranConfig = (XranConfig) config.get();
 
-            northbound_timeout = xranConfig.getNorthBoundTimeout();
+            northboundTimeout = xranConfig.getNorthBoundTimeout();
 
             legitCells.putAll(xranConfig.activeCellSet());
 
diff --git a/src/main/java/org.onosproject.xran/controller/XranDeviceAgent.java b/src/main/java/org.onosproject.xran/controller/XranDeviceAgent.java
index b81a628..a322c47 100644
--- a/src/main/java/org.onosproject.xran/controller/XranDeviceAgent.java
+++ b/src/main/java/org.onosproject.xran/controller/XranDeviceAgent.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,11 +19,24 @@
 import io.netty.channel.ChannelHandlerContext;
 
 /**
- * Created by dimitris on 7/27/17.
+ * Xran device agent interface.
  */
 public interface XranDeviceAgent {
 
+    /**
+     * Add connected CELL.
+     *
+     * @param host IP of host trying to connect
+     * @param ctx  channel of CELL speaking to
+     * @return true if succeeded
+     */
     boolean addConnectedCell(String host, ChannelHandlerContext ctx);
 
+    /**
+     * Remove disconnected CELL.
+     *
+     * @param host IP of host disconnected
+     * @return true if remove succeeded
+     */
     boolean removeConnectedCell(String host);
 }
diff --git a/src/main/java/org.onosproject.xran/controller/XranHostAgent.java b/src/main/java/org.onosproject.xran/controller/XranHostAgent.java
index 07ab26e..9c335da 100644
--- a/src/main/java/org.onosproject.xran/controller/XranHostAgent.java
+++ b/src/main/java/org.onosproject.xran/controller/XranHostAgent.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.
@@ -21,10 +21,25 @@
 import org.onosproject.xran.entities.RnibUe;
 
 /**
- * Created by dimitris on 7/28/17.
+ * Xran host agent interface.
  */
 public interface XranHostAgent {
+
+    /**
+     * Add connected host.
+     *
+     * @param ue   UE entity
+     * @param cell CELL entity
+     * @param ctx  channel of CELL
+     * @return true if succeeded
+     */
     boolean addConnectedHost(RnibUe ue, RnibCell cell, ChannelHandlerContext ctx);
 
+    /**
+     * Remove disconnected host.
+     *
+     * @param ue UE entity
+     * @return true if remove succeeded
+     */
     boolean removeConnectedHost(RnibUe ue);
 }
diff --git a/src/main/java/org.onosproject.xran/controller/XranPacketProcessor.java b/src/main/java/org.onosproject.xran/controller/XranPacketProcessor.java
index 73cb587..893b21d 100644
--- a/src/main/java/org.onosproject.xran/controller/XranPacketProcessor.java
+++ b/src/main/java/org.onosproject.xran/controller/XranPacketProcessor.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,11 +17,21 @@
 package org.onosproject.xran.controller;
 
 import io.netty.channel.ChannelHandlerContext;
-import org.onosproject.net.DeviceId;
 import org.onosproject.xran.codecs.pdu.XrancPdu;
 
 import java.io.IOException;
 
+/**
+ * Xran packet processor interface.
+ */
 public interface XranPacketProcessor {
+    /**
+     * Handle an incoming packet.
+     *
+     * @param pdu pdu of incoming packet
+     * @param ctx channel received the packet
+     * @throws IOException io exception
+     * @throws InterruptedException interrupted exception
+     */
     void handlePacket(XrancPdu pdu, ChannelHandlerContext ctx) throws IOException, InterruptedException;
 }
diff --git a/src/main/java/org.onosproject.xran/controller/package-info.java b/src/main/java/org.onosproject.xran/controller/package-info.java
index 7f4660f..866c396 100644
--- a/src/main/java/org.onosproject.xran/controller/package-info.java
+++ b/src/main/java/org.onosproject.xran/controller/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/src/main/java/org.onosproject.xran/entities/RnibCell.java b/src/main/java/org.onosproject.xran/entities/RnibCell.java
index ac29eba..c7ffe69 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibCell.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibCell.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.
@@ -16,7 +16,11 @@
 
 package org.onosproject.xran.entities;
 
-import com.fasterxml.jackson.annotation.*;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
 import com.fasterxml.jackson.databind.JsonNode;
 import org.onosproject.net.DeviceId;
 import org.onosproject.store.service.WallClockTimestamp;
@@ -41,10 +45,10 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-/**
- * Created by dimitris on 7/22/17.
- */
 
+/**
+ * R-NIB Cell and its properties.
+ */
 @JsonPropertyOrder({
         "ECGI",
         "Configuration",
@@ -81,6 +85,12 @@
         rrmConfig.setEcgi(ecgi);
     }
 
+    /**
+     * Encode ECGI and obtain its URI.
+     *
+     * @param ecgi ECGI
+     * @return URI
+     */
     public static URI uri(ECGI ecgi) {
         if (ecgi != null) {
             try {
@@ -95,6 +105,13 @@
         return null;
     }
 
+    /**
+     * Obtain ECGI from the device ID.
+     *
+     * @param deviceId ID of the device
+     * @return ECGI
+     * @throws IOException I0 Exception for ByteArrayInputStream
+     */
     public static ECGI decodeDeviceId(DeviceId deviceId) throws IOException {
         String uri = deviceId.toString();
         String hexEcgi = uri.substring(uri.lastIndexOf("xran:") + 5);
@@ -107,65 +124,120 @@
         return ecgi;
     }
 
+    /**
+     * Get version ID.
+     *
+     * @return version ID
+     */
     public int getVersion() {
         return Integer.parseInt(version);
     }
 
+    /**
+     * Set version ID.
+     *
+     * @param version version ID
+     */
     public void setVersion(String version) {
         this.version = version;
     }
 
+    /**
+     * Get RRMConfig.
+     *
+     * @return RRMConfig
+     */
     @JsonProperty("RRMConfiguration")
     public RRMConfig getRrmConfig() {
         return rrmConfig;
     }
 
+    /**
+     * Set RRMConfig properties.
+     *
+     * @param rrmConfig RRMConfig
+     */
     @JsonProperty("RRMConfiguration")
     public void setRrmConfig(RRMConfig rrmConfig) {
         this.rrmConfig = rrmConfig;
     }
 
+    /**
+     * Get PRB Usage.
+     * @return prb usage
+     */
     @JsonProperty("PRB-Usage")
     public PrbUsageContainer getPrbUsage() {
         return prbUsage;
     }
 
+    /**
+     * Set PRB Usage.
+     *
+     * @param prbUsage prb Usage
+     */
     @JsonProperty("PRB-Usage")
     public void setPrbUsage(PrbUsageContainer prbUsage) {
         this.prbUsage = prbUsage;
     }
 
+    /**
+     * Get ECGI.
+     *
+     * @return ECGI
+     */
     @JsonProperty("ECGI")
     public ECGI getEcgi() {
         return ecgi;
     }
 
+    /**
+     * Set ECGI.
+     *
+     * @param ecgi ECGI
+     */
     @JsonProperty("ECGI")
     public void setEcgi(ECGI ecgi) {
         this.ecgi = ecgi;
     }
 
+    /**
+     * Get cell config report.
+     *
+     * @return CellConfig Report
+     */
     @JsonProperty("Configuration")
     public CellConfigReport getConf() {
         return conf;
     }
 
+    /**
+     * Set cell config report.
+     *
+     * @param conf Cell config report
+     */
     @JsonProperty("Configuration")
     public void setConf(CellConfigReport conf) {
         this.conf = conf;
     }
 
+    /**
+     * Modify the RRM Config parameters of cell.
+     *
+     * @param rrmConfigNode RRMConfig parameters to modify obtained from REST call
+     * @param ueList List of all UEs
+     * @throws Exception p_a size not equal to UE size
+     */
     public void modifyRrmConfig(JsonNode rrmConfigNode, List<RnibUe> ueList) throws Exception {
         RRMConfig.Crnti crnti = new RRMConfig.Crnti();
         ueList.forEach(ue -> crnti.addCRNTI(ue.getCrnti()));
 
-        {
-            JsonNode p_a = rrmConfigNode.path("p_a");
-            if (!p_a.isMissingNode()) {
+            JsonNode pA = rrmConfigNode.path("p_a");
+            if (!pA.isMissingNode()) {
                 RRMConfig.Pa pa = new RRMConfig.Pa();
-                if (p_a.isArray()) {
-                    if (ueList.size() == p_a.size()) {
-                        List<XICICPA> collect = Stream.of(p_a)
+                if (pA.isArray()) {
+                    if (ueList.size() == pA.size()) {
+                        List<XICICPA> collect = Stream.of(pA)
                                 .map(val -> new XICICPA(val.asInt()))
                                 .collect(Collectors.toList());
                         pa.setXICICPA(collect);
@@ -175,15 +247,13 @@
                 }
                 rrmConfig.setPa(pa);
             }
-        }
 
-        {
-            JsonNode start_prb_dl = rrmConfigNode.path("start_prb_dl");
-            if (!start_prb_dl.isMissingNode()) {
+            JsonNode startPrbDl1 = rrmConfigNode.path("start_prb_dl");
+            if (!startPrbDl1.isMissingNode()) {
                 RRMConfig.StartPrbDl startPrbDl = new RRMConfig.StartPrbDl();
-                if (start_prb_dl.isArray()) {
-                    if (ueList.size() == start_prb_dl.size()) {
-                        List<BerInteger> collect = Stream.of(start_prb_dl)
+                if (startPrbDl1.isArray()) {
+                    if (ueList.size() == startPrbDl1.size()) {
+                        List<BerInteger> collect = Stream.of(startPrbDl1)
                                 .map(val -> new BerInteger(val.asInt()))
                                 .collect(Collectors.toList());
                         startPrbDl.setSeqOf(collect);
@@ -193,15 +263,13 @@
                 }
                 rrmConfig.setStartPrbDl(startPrbDl);
             }
-        }
 
-        {
-            JsonNode end_prb_dl = rrmConfigNode.path("end_prb_dl");
-            if (!end_prb_dl.isMissingNode()) {
+            JsonNode endPrbDl1 = rrmConfigNode.path("end_prb_dl");
+            if (!endPrbDl1.isMissingNode()) {
                 RRMConfig.EndPrbDl endPrbDl = new RRMConfig.EndPrbDl();
-                if (end_prb_dl.isArray()) {
-                    if (ueList.size() == end_prb_dl.size()) {
-                        List<BerInteger> collect = Stream.of(end_prb_dl)
+                if (endPrbDl1.isArray()) {
+                    if (ueList.size() == endPrbDl1.size()) {
+                        List<BerInteger> collect = Stream.of(endPrbDl1)
                                 .map(val -> new BerInteger(val.asInt()))
                                 .collect(Collectors.toList());
                         endPrbDl.setSeqOf(collect);
@@ -211,14 +279,12 @@
                 }
                 rrmConfig.setEndPrbDl(endPrbDl);
             }
-        }
 
-        {
-            JsonNode sub_frame_bitmask_dl = rrmConfigNode.path("sub_frame_bitmask_dl");
-            if (!sub_frame_bitmask_dl.isMissingNode()) {
+            JsonNode frameBitmaskDl = rrmConfigNode.path("sub_frame_bitmask_dl");
+            if (!frameBitmaskDl.isMissingNode()) {
                 RRMConfig.SubframeBitmaskDl subframeBitmaskDl = new RRMConfig.SubframeBitmaskDl();
-                if (sub_frame_bitmask_dl.isArray()) {
-                    List<BerBitString> collect = Stream.of(sub_frame_bitmask_dl)
+                if (frameBitmaskDl.isArray()) {
+                    List<BerBitString> collect = Stream.of(frameBitmaskDl)
                             .map(val -> new BerBitString(DatatypeConverter.parseHexBinary(val.asText()), 10))
                             .collect(Collectors.toList());
 
@@ -228,15 +294,13 @@
                 }
                 rrmConfig.setSubframeBitmaskDl(subframeBitmaskDl);
             }
-        }
 
-        {
-            JsonNode start_prb_ul = rrmConfigNode.path("start_prb_ul");
-            if (!start_prb_ul.isMissingNode()) {
+            JsonNode startPrbUl1 = rrmConfigNode.path("start_prb_ul");
+            if (!startPrbUl1.isMissingNode()) {
                 RRMConfig.StartPrbUl startPrbUl = new RRMConfig.StartPrbUl();
-                if (start_prb_ul.isArray()) {
-                    if (ueList.size() == start_prb_ul.size()) {
-                        List<BerInteger> collect = Stream.of(start_prb_ul)
+                if (startPrbUl1.isArray()) {
+                    if (ueList.size() == startPrbUl1.size()) {
+                        List<BerInteger> collect = Stream.of(startPrbUl1)
                                 .map(val -> new BerInteger(val.asInt()))
                                 .collect(Collectors.toList());
                         startPrbUl.setSeqOf(collect);
@@ -246,15 +310,13 @@
                 }
                 rrmConfig.setStartPrbUl(startPrbUl);
             }
-        }
 
-        {
-            JsonNode end_prb_ul = rrmConfigNode.path("end_prb_ul");
-            if (!end_prb_ul.isMissingNode()) {
+            JsonNode endPrbUl1 = rrmConfigNode.path("end_prb_ul");
+            if (!endPrbUl1.isMissingNode()) {
                 RRMConfig.EndPrbUl endPrbUl = new RRMConfig.EndPrbUl();
-                if (end_prb_ul.isArray()) {
-                    if (ueList.size() == end_prb_ul.size()) {
-                        List<BerInteger> collect = Stream.of(end_prb_ul)
+                if (endPrbUl1.isArray()) {
+                    if (ueList.size() == endPrbUl1.size()) {
+                        List<BerInteger> collect = Stream.of(endPrbUl1)
                                 .map(val -> new BerInteger(val.asInt()))
                                 .collect(Collectors.toList());
                         endPrbUl.setSeqOf(collect);
@@ -264,15 +326,13 @@
                 }
                 rrmConfig.setEndPrbUl(endPrbUl);
             }
-        }
 
-        {
-            JsonNode p0_ue_pusch = rrmConfigNode.path("p0_ue_pusch");
-            if (!p0_ue_pusch.isMissingNode()) {
+            JsonNode uePusch = rrmConfigNode.path("p0_ue_pusch");
+            if (!uePusch.isMissingNode()) {
                 RRMConfig.P0UePusch p0UePusch = new RRMConfig.P0UePusch();
-                if (p0_ue_pusch.isArray()) {
-                    if (ueList.size() == p0_ue_pusch.size()) {
-                        List<BerInteger> collect = Stream.of(p0_ue_pusch)
+                if (uePusch.isArray()) {
+                    if (ueList.size() == uePusch.size()) {
+                        List<BerInteger> collect = Stream.of(uePusch)
                                 .map(val -> new BerInteger(val.asInt()))
                                 .collect(Collectors.toList());
                         p0UePusch.setSeqOf(collect);
@@ -282,14 +342,12 @@
                 }
                 rrmConfig.setP0UePusch(p0UePusch);
             }
-        }
 
-        {
-            JsonNode sub_frame_bitmask_ul = rrmConfigNode.path("sub_frame_bitmask_ul");
-            if (!sub_frame_bitmask_ul.isMissingNode()) {
+            JsonNode frameBitmaskUl = rrmConfigNode.path("sub_frame_bitmask_ul");
+            if (!frameBitmaskUl.isMissingNode()) {
                 RRMConfig.SubframeBitmaskUl subframeBitmaskUl = new RRMConfig.SubframeBitmaskUl();
-                if (sub_frame_bitmask_ul.isArray()) {
-                    List<BerBitString> collect = Stream.of(sub_frame_bitmask_ul)
+                if (frameBitmaskUl.isArray()) {
+                    List<BerBitString> collect = Stream.of(frameBitmaskUl)
                             .map(val -> new BerBitString(DatatypeConverter.parseHexBinary(val.asText()), 10))
                             .collect(Collectors.toList());
 
@@ -299,26 +357,45 @@
                 }
                 rrmConfig.setSubframeBitmaskUl(subframeBitmaskUl);
             }
-        }
 
         rrmConfig.setCrnti(crnti);
     }
 
+    /**
+     * Get QCI values.
+     *
+     * @return QCI values
+     */
     @JsonProperty("QCI")
     public SchedMeasReportPerCell.QciVals getQci() {
         return qci;
     }
 
+    /**
+     * Set QCI values.
+     *
+     * @param qci QCI
+     */
     @JsonProperty("QCI")
     public void setQci(SchedMeasReportPerCell.QciVals qci) {
         this.qci = qci;
     }
 
+    /**
+     * Get L2 measurement config.
+     *
+     * @return L2MeasConfig
+     */
     @JsonProperty("MeasurementConfiguration")
     public L2MeasConfig getMeasConfig() {
         return measConfig;
     }
 
+    /**
+     * Set L2 measurement config.
+     *
+     * @param measConfig l2MeasConfig
+     */
     @JsonProperty("MeasurementConfiguration")
     public void setMeasConfig(L2MeasConfig measConfig) {
         this.measConfig = measConfig;
@@ -337,21 +414,38 @@
                 '}';
     }
 
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals()
+     */
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
 
         RnibCell rnibCell = (RnibCell) o;
 
         return ecgi.equals(rnibCell.ecgi);
     }
 
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
     @Override
     public int hashCode() {
         return ecgi.hashCode();
     }
 
+    /**
+     * Container class for PRBUsage.
+     */
     @JsonPropertyOrder({
             "primary",
             "secondary",
@@ -364,33 +458,65 @@
         WallClockTimestamp timesincelastupdate;
 
         @JsonCreator
-        public PrbUsageContainer(@JsonProperty("primary") PRBUsage primary, @JsonProperty("secondary") PRBUsage secondary) {
+        public PrbUsageContainer(@JsonProperty("primary") PRBUsage primary,
+                                 @JsonProperty("secondary") PRBUsage secondary) {
             this.primary = primary;
             this.secondary = secondary;
             this.timesincelastupdate = new WallClockTimestamp();
         }
 
+        /**
+         * Get primary PRBUsage.
+         *
+         * @return PRBUsage
+         */
         public PRBUsage getPrimary() {
             return primary;
         }
 
+        /**
+         * Set secondary PRBUsage.
+         *
+         * @param primary PRBUsage
+         */
         public void setPrimary(PRBUsage primary) {
             this.primary = primary;
         }
 
+        /**
+         * Get secondary PRBUsage.
+         *
+         * @return PRBUsage
+         */
         public PRBUsage getSecondary() {
             return secondary;
         }
 
+        /**
+         * Set secondary PRBUsage.
+         *
+         * @param secondary PRBUsage
+         */
         public void setSecondary(PRBUsage secondary) {
             this.secondary = secondary;
         }
 
-        public long getTimesincelastupdate() {
+        /**
+         * Get time since last update.
+         *
+         * @return long Time
+         */
+        public long getTimeSinceLastUpdate() {
             return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
         }
 
-        public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
+
+        /**
+         * Set time since last update.
+         *
+         * @param timesincelastupdate time since last update
+         */
+        public void setTimeSinceLastUpdate(WallClockTimestamp timesincelastupdate) {
             this.timesincelastupdate = timesincelastupdate;
         }
 
@@ -399,7 +525,8 @@
             return "PrbUsageContainer{" +
                     "primary=" + primary +
                     ", secondary=" + secondary +
-                    ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+                    ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+                    timesincelastupdate.unixTimestamp()) +
                     '}';
         }
     }
diff --git a/src/main/java/org.onosproject.xran/entities/RnibLink.java b/src/main/java/org.onosproject.xran/entities/RnibLink.java
index 13a0d93..4eb18a8 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibLink.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibLink.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.
@@ -16,11 +16,20 @@
 
 package org.onosproject.xran.entities;
 
-import com.fasterxml.jackson.annotation.*;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.collect.Lists;
 import org.onosproject.store.service.WallClockTimestamp;
-import org.onosproject.xran.codecs.api.*;
+import org.onosproject.xran.codecs.api.ERABParams;
+import org.onosproject.xran.codecs.api.RadioRepPerServCell;
+import org.onosproject.xran.codecs.api.TrafficSplitPercentage;
+import org.onosproject.xran.codecs.api.XICICPA;
+import org.onosproject.xran.codecs.api.SchedMeasRepPerServCell;
+import org.onosproject.xran.codecs.api.PRBUsage;
 import org.onosproject.xran.codecs.ber.types.BerBitString;
 import org.onosproject.xran.codecs.ber.types.BerInteger;
 import org.onosproject.xran.codecs.pdu.PDCPMeasReportPerUe;
@@ -36,7 +45,7 @@
 import java.util.Timer;
 
 /**
- * Created by dimitris on 7/22/17.
+ * R-NIB Link and its properties.
  */
 @JsonPropertyOrder({
         "Link-ID",
@@ -66,9 +75,9 @@
     @JsonProperty("Quality")
     private LinkQuality quality;
     @JsonProperty("PDCP-Throughput")
-    private PDCPThroughput pdcpThroughput;
+    private PdcpThroughput pdcpThroughput;
     @JsonProperty("PDCP-Packet-Delay")
-    private PDCPPacketDelay pdcpPackDelay;
+    private PdcpPacketdelay pdcpPackDelay;
     @JsonProperty("Resource-Usage")
     private ResourceUsage resourceUsage;
     @JsonProperty("Type")
@@ -97,6 +106,11 @@
         rrmParameters.setEcgi(linkId.getEcgi());
     }
 
+    /**
+     * Get timer.
+     *
+     * @return Timer
+     */
     public Timer getTimer() {
         return timer;
     }
@@ -107,201 +121,270 @@
         this.timer = timer;
     }
 
+    /**
+     * Get Link ID.
+     * @return LinkID
+     */
     @JsonProperty("Link-ID")
     public LinkId getLinkId() {
         return linkId;
     }
 
+    /**
+     * Set the Link ID.
+     * @param linkId Link ID
+     */
     @JsonProperty("Link-ID")
     public void setLinkId(LinkId linkId) {
         this.linkId = linkId;
     }
 
+    /**
+     * Set the LINK ID with cell and ue.
+     * @param cell Rnib CELL
+     * @param ue Rnib UE
+     */
     public void setLinkId(RnibCell cell, RnibUe ue) {
         this.linkId = LinkId.valueOf(cell, ue);
         trafficPercent.setEcgi(cell.getEcgi());
     }
 
+    /**
+     * Get the link type.
+     *
+     * @return Link-type
+     */
     @JsonProperty("Type")
     public Type getType() {
         return type;
     }
 
+    /**
+     * Set the link type.
+     * @param type Link-type
+     */
     @JsonProperty("Type")
     public void setType(Type type) {
         this.type = type;
     }
 
+    /**
+     * Get traffic percent.
+     * @return TrafficSplitPercentage
+     */
     @JsonProperty("TrafficPercent")
     public TrafficSplitPercentage getTrafficPercent() {
         return trafficPercent;
     }
 
+    /**
+     * Set traffic percent.
+     * @param trafficPercent TrafficSplitPercentage
+     */
     @JsonProperty("TrafficPercent")
     public void setTrafficPercent(TrafficSplitPercentage trafficPercent) {
         this.trafficPercent = trafficPercent;
     }
 
+    /**
+     * Get the Bearer Parameters.
+     * @return ERABParams
+     */
     @JsonProperty("BearerParameters")
     public ERABParams getBearerParameters() {
         return bearerParameters;
     }
 
+    /**
+     * Set the Bearer Parameters.
+     * @param bearerParameters ERABParams
+     */
     @JsonProperty("BearerParameters")
     public void setBearerParameters(ERABParams bearerParameters) {
         this.bearerParameters = bearerParameters;
     }
 
+    /**
+     * Get Quality.
+     * @return LinkQuality
+     */
     @JsonProperty("Quality")
     public LinkQuality getQuality() {
         return quality;
     }
 
+    /**
+     * Set Quality.
+     * @param quality LinkQuality
+     */
     @JsonProperty("Quality")
     public void setQuality(LinkQuality quality) {
         this.quality = quality;
     }
 
+    /**
+     * Get RRM Configuration.
+     * @return RRMConfig
+     */
     @JsonProperty("RRMConfiguration")
     public RRMConfig getRrmParameters() {
         return rrmParameters;
     }
 
+    /**
+     * Set RRM Configuration.
+     * @param rrmParameters RRMConfig
+     */
     @JsonProperty("RRMConfiguration")
     public void setRrmParameters(RRMConfig rrmParameters) {
         this.rrmParameters = rrmParameters;
     }
 
+    /**
+     * Modify the RRM Config parameters of link.
+     *
+     * @param rrmConfigNode RRMConfig parameters to modify obtained from REST call
+     */
     public void modifyRrmParameters(JsonNode rrmConfigNode) {
-        {
-            JsonNode p_a = rrmConfigNode.path("p_a");
-            if (!p_a.isMissingNode()) {
-                RRMConfig.Pa pa = new RRMConfig.Pa();
 
-                List<XICICPA> collect = Lists.newArrayList();
-                collect.add(new XICICPA(p_a.asInt()));
-                pa.setXICICPA(collect);
-                rrmParameters.setPa(pa);
-            }
+        JsonNode pA = rrmConfigNode.path("p_a");
+        if (!pA.isMissingNode()) {
+            RRMConfig.Pa pa = new RRMConfig.Pa();
+
+            List<XICICPA> collect = Lists.newArrayList();
+            collect.add(new XICICPA(pA.asInt()));
+            pa.setXICICPA(collect);
+            rrmParameters.setPa(pa);
         }
 
-        {
-            JsonNode start_prb_dl = rrmConfigNode.path("start_prb_dl");
-            if (!start_prb_dl.isMissingNode()) {
-                RRMConfig.StartPrbDl startPrbDl = new RRMConfig.StartPrbDl();
+        JsonNode startPrbDl1 = rrmConfigNode.path("start_prb_dl");
+        if (!startPrbDl1.isMissingNode()) {
+            RRMConfig.StartPrbDl startPrbDl = new RRMConfig.StartPrbDl();
 
-                List<BerInteger> collect = Lists.newArrayList();
-                collect.add(new BerInteger(start_prb_dl.asInt()));
-                startPrbDl.setSeqOf(collect);
+            List<BerInteger> collect = Lists.newArrayList();
+            collect.add(new BerInteger(startPrbDl1.asInt()));
+            startPrbDl.setSeqOf(collect);
 
-                rrmParameters.setStartPrbDl(startPrbDl);
-            }
+            rrmParameters.setStartPrbDl(startPrbDl);
         }
 
-        {
-            JsonNode end_prb_dl = rrmConfigNode.path("end_prb_dl");
-            if (!end_prb_dl.isMissingNode()) {
-                RRMConfig.EndPrbDl endPrbDl = new RRMConfig.EndPrbDl();
+        JsonNode endPrbDl1 = rrmConfigNode.path("end_prb_dl");
+        if (!endPrbDl1.isMissingNode()) {
+            RRMConfig.EndPrbDl endPrbDl = new RRMConfig.EndPrbDl();
 
-                List<BerInteger> collect = Lists.newArrayList();
-                collect.add(new BerInteger(end_prb_dl.asInt()));
-                endPrbDl.setSeqOf(collect);
+            List<BerInteger> collect = Lists.newArrayList();
+            collect.add(new BerInteger(endPrbDl1.asInt()));
+            endPrbDl.setSeqOf(collect);
 
-                rrmParameters.setEndPrbDl(endPrbDl);
-            }
+            rrmParameters.setEndPrbDl(endPrbDl);
         }
 
-        {
-            JsonNode sub_frame_bitmask_dl = rrmConfigNode.path("sub_frame_bitmask_dl");
-            if (!sub_frame_bitmask_dl.isMissingNode()) {
-                RRMConfig.SubframeBitmaskDl subframeBitmaskDl = new RRMConfig.SubframeBitmaskDl();
-                List<BerBitString> collect = Lists.newArrayList();
-                
-                byte[] hexString = DatatypeConverter.parseHexBinary(sub_frame_bitmask_dl.asText());
-                collect.add(new BerBitString(hexString, 10));
-                subframeBitmaskDl.setSeqOf(collect);
-                rrmParameters.setSubframeBitmaskDl(subframeBitmaskDl);
-            }
+        JsonNode subFrameBitmaskDl = rrmConfigNode.path("sub_frame_bitmask_dl");
+        if (!subFrameBitmaskDl.isMissingNode()) {
+            RRMConfig.SubframeBitmaskDl subframeBitmaskDl = new RRMConfig.SubframeBitmaskDl();
+            List<BerBitString> collect = Lists.newArrayList();
+
+            byte[] hexString = DatatypeConverter.parseHexBinary(subFrameBitmaskDl.asText());
+            collect.add(new BerBitString(hexString, 10));
+            subframeBitmaskDl.setSeqOf(collect);
+            rrmParameters.setSubframeBitmaskDl(subframeBitmaskDl);
         }
 
-        {
-            JsonNode start_prb_ul = rrmConfigNode.path("start_prb_ul");
-            if (!start_prb_ul.isMissingNode()) {
-                RRMConfig.StartPrbUl startPrbUl = new RRMConfig.StartPrbUl();
+        JsonNode startPrbUl1 = rrmConfigNode.path("start_prb_ul");
+        if (!startPrbUl1.isMissingNode()) {
+            RRMConfig.StartPrbUl startPrbUl = new RRMConfig.StartPrbUl();
 
-                List<BerInteger> collect = Lists.newArrayList();
-                collect.add(new BerInteger(start_prb_ul.asInt()));
-                startPrbUl.setSeqOf(collect);
+            List<BerInteger> collect = Lists.newArrayList();
+            collect.add(new BerInteger(startPrbUl1.asInt()));
+            startPrbUl.setSeqOf(collect);
 
-                rrmParameters.setStartPrbUl(startPrbUl);
-            }
+            rrmParameters.setStartPrbUl(startPrbUl);
         }
 
-        {
-            JsonNode end_prb_ul = rrmConfigNode.path("end_prb_ul");
-            if (!end_prb_ul.isMissingNode()) {
-                RRMConfig.EndPrbUl endPrbUl = new RRMConfig.EndPrbUl();
+        JsonNode endPrbUl1 = rrmConfigNode.path("end_prb_ul");
+        if (!endPrbUl1.isMissingNode()) {
+            RRMConfig.EndPrbUl endPrbUl = new RRMConfig.EndPrbUl();
 
-                List<BerInteger> collect = Lists.newArrayList();
-                collect.add(new BerInteger(end_prb_ul.asInt()));
-                endPrbUl.setSeqOf(collect);
+            List<BerInteger> collect = Lists.newArrayList();
+            collect.add(new BerInteger(endPrbUl1.asInt()));
+            endPrbUl.setSeqOf(collect);
 
-                rrmParameters.setEndPrbUl(endPrbUl);
-            }
+            rrmParameters.setEndPrbUl(endPrbUl);
         }
 
-        {
-            JsonNode p0_ue_pusch = rrmConfigNode.path("p0_ue_pusch");
-            if (!p0_ue_pusch.isMissingNode()) {
-                RRMConfig.P0UePusch p0UePusch = new RRMConfig.P0UePusch();
 
-                List<BerInteger> collect = Lists.newArrayList();
-                collect.add(new BerInteger(p0_ue_pusch.asInt()));
-                p0UePusch.setSeqOf(collect);
+        JsonNode p0UePusch1 = rrmConfigNode.path("p0_ue_pusch");
+        if (!p0UePusch1.isMissingNode()) {
+            RRMConfig.P0UePusch p0UePusch = new RRMConfig.P0UePusch();
 
-                rrmParameters.setP0UePusch(p0UePusch);
-            }
+            List<BerInteger> collect = Lists.newArrayList();
+            collect.add(new BerInteger(p0UePusch1.asInt()));
+            p0UePusch.setSeqOf(collect);
+
+            rrmParameters.setP0UePusch(p0UePusch);
         }
 
-        {
-            JsonNode sub_frame_bitmask_ul = rrmConfigNode.path("sub_frame_bitmask_ul");
-            if (!sub_frame_bitmask_ul.isMissingNode()) {
-                RRMConfig.SubframeBitmaskUl subframeBitmaskUl = new RRMConfig.SubframeBitmaskUl();
-                List<BerBitString> collect = Lists.newArrayList();
+        JsonNode subFrameBitmaskUl = rrmConfigNode.path("sub_frame_bitmask_ul");
+        if (!subFrameBitmaskUl.isMissingNode()) {
+            RRMConfig.SubframeBitmaskUl subframeBitmaskUl = new RRMConfig.SubframeBitmaskUl();
+            List<BerBitString> collect = Lists.newArrayList();
 
-                byte[] hexString = DatatypeConverter.parseHexBinary(sub_frame_bitmask_ul.asText());
-                collect.add(new BerBitString(hexString, 10));
-                subframeBitmaskUl.setSeqOf(collect);
-                rrmParameters.setSubframeBitmaskUl(subframeBitmaskUl);
-            }
+            byte[] hexString = DatatypeConverter.parseHexBinary(subFrameBitmaskUl.asText());
+            collect.add(new BerBitString(hexString, 10));
+            subframeBitmaskUl.setSeqOf(collect);
+            rrmParameters.setSubframeBitmaskUl(subframeBitmaskUl);
         }
     }
 
+    /**
+     * Get PDCP Throughput.
+     * @return PdcpThroughput
+     */
     @JsonProperty("PDCP-Throughput")
-    public PDCPThroughput getPdcpThroughput() {
+    public PdcpThroughput getPdcpThroughput() {
         return pdcpThroughput;
     }
 
+    /**
+     * Set PDCP Throughput.
+     * @param pdcpThroughput PdcpThroughput
+     */
     @JsonProperty("PDCP-Throughput")
-    public void setPdcpThroughput(PDCPThroughput pdcpThroughput) {
+    public void setPdcpThroughput(PdcpThroughput pdcpThroughput) {
         this.pdcpThroughput = pdcpThroughput;
     }
 
+    /**
+     * Get PdcpPackDelay.
+     * @return PdcpPacketdelay
+     */
     @JsonProperty("PDCP-Packet-Delay")
-    public PDCPPacketDelay getPdcpPackDelay() {
+    public PdcpPacketdelay getPdcpPackDelay() {
         return pdcpPackDelay;
     }
 
+    /**
+     * Set PdcpPackDelay.
+     * @param pdcpPackDelay PdcpPacketdelay
+     */
     @JsonProperty("PDCP-Packet-Delay")
-    public void setPdcpPackDelay(PDCPPacketDelay pdcpPackDelay) {
+    public void setPdcpPackDelay(PdcpPacketdelay pdcpPackDelay) {
         this.pdcpPackDelay = pdcpPackDelay;
     }
 
+    /**
+     * Get ResourceUsage.
+     * @return ResourceUsage
+     */
     @JsonProperty("Resource-Usage")
     public ResourceUsage getResourceUsage() {
         return resourceUsage;
     }
 
+    /**
+     * Set ResourceUsage.
+     * @param resourceUsage ResourceUsage
+     */
     @JsonProperty("Resource-Usage")
     public void setResourceUsage(ResourceUsage resourceUsage) {
         this.resourceUsage = resourceUsage;
@@ -325,8 +408,12 @@
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
 
         RnibLink link = (RnibLink) o;
 
@@ -338,30 +425,32 @@
         return linkId.hashCode();
     }
 
+    /**
+     * Enum of Link-Type.
+     */
     public enum Type {
         SERVING_PRIMARY("serving/primary") {
             @Override
             public String toString() {
-                return "\"serving/primary\"";
+                return "serving/primary";
             }
         },
-        // TODO: Add CA/DC
         SERVING_SECONDARY_CA("serving/secondary/ca") {
             @Override
             public String toString() {
-                return "\"serving/secondary/ca\"";
+                return "serving/secondary/ca";
             }
         },
         SERVING_SECONDARY_DC("serving/secondary/dc") {
             @Override
             public String toString() {
-                return "\"serving/secondary/dc\"";
+                return "serving/secondary/dc";
             }
         },
         NON_SERVING("non-serving") {
             @Override
             public String toString() {
-                return "\"non-serving\"";
+                return "non-serving";
             }
         };
 
@@ -371,6 +460,11 @@
             this.name = name;
         }
 
+        /**
+         * Get enum value of link-type.
+         * @param name String representation of Enum Type
+         * @return Type
+         */
         public static Type getEnum(String name) {
             Optional<Type> any = Arrays.stream(Type.values()).filter(typeStr -> typeStr.name.equals(name)).findAny();
             if (any.isPresent()) {
@@ -380,153 +474,247 @@
         }
     }
 
+    /**
+     * Quality of Link.
+     */
     @JsonPropertyOrder({
-            "RX",
-            "CQI",
-            "MCS"
+            "rx",
+            "cqi",
+            "mcs"
     })
     @JsonIgnoreProperties(ignoreUnknown = true)
     public static class LinkQuality {
-        RX RX = null;
-        CQI CQI = null;
-        MCS MCS = null;
+        Rx rx = null;
+        Cqi cqi = null;
+        Mcs mcs = null;
 
-        public LinkQuality.RX getRX() {
-            return RX;
+        /**
+         * Get rx.
+         * @return rx
+         */
+        public Rx getRx() {
+            return rx;
         }
 
-        public void setRX(LinkQuality.RX RX) {
-            this.RX = RX;
+        /**
+         * Set rx.
+         * @param rx rx
+         */
+        public void setRx(Rx rx) {
+            this.rx = rx;
         }
 
-        public LinkQuality.CQI getCQI() {
-            return CQI;
+        /**
+         * Get cqi.
+         * @return cqi
+         */
+        public Cqi getCqi() {
+            return cqi;
         }
 
-        public void setCQI(LinkQuality.CQI CQI) {
-            this.CQI = CQI;
+        /**
+         * Set cqi.
+         * @param cqi cqi
+         */
+        public void setCqi(Cqi cqi) {
+            this.cqi = cqi;
         }
 
-        public LinkQuality.MCS getMCS() {
-            return MCS;
+        /**
+         * Get mcs.
+         * @return mcs
+         */
+        public Mcs getMcs() {
+            return mcs;
         }
 
-        public void setMCS(LinkQuality.MCS MCS) {
-            this.MCS = MCS;
+        /**
+         * Set mcs.
+         * @param mcs mcs
+         */
+        public void setMcs(Mcs mcs) {
+            this.mcs = mcs;
         }
 
+        /**
+         * Class to represent rx.
+         */
         @JsonPropertyOrder({
-                "RSRP",
-                "RSRQ",
+                "rsrp",
+                "rsrq",
                 "timesincelastupdate"
         })
         @JsonIgnoreProperties(ignoreUnknown = true)
-        public static class RX {
-            double RSRP;
-            double RSRQ;
+        public static class Rx {
+            double rsrp;
+            double rsrq;
             WallClockTimestamp timesincelastupdate;
 
             @JsonCreator
-            public RX(@JsonProperty("RSRP") double RSRP, @JsonProperty("RSRQ") double RSRQ) {
-                this.RSRP = RSRP;
-                this.RSRQ = RSRQ;
+            public Rx(@JsonProperty("rsrp") double rsrp, @JsonProperty("rsrq") double rsrq) {
+                this.rsrp = rsrp;
+                this.rsrq = rsrq;
                 this.timesincelastupdate = new WallClockTimestamp();
             }
 
-            public double getRSRP() {
-                return RSRP;
+            /**
+             * Get rsrp.
+             * @return double rsrp
+             */
+            public double getRsrp() {
+                return rsrp;
             }
 
-            public void setRSRP(double RSRP) {
-                this.RSRP = RSRP;
+            /**
+             * Set rsrp.
+             * @param rsrp rsrp
+             */
+            public void setRsrp(double rsrp) {
+                this.rsrp = rsrp;
             }
 
-            public double getRSRQ() {
-                return RSRQ;
+            /**
+             * Get rsrq.
+             * @return double rsrq
+             */
+            public double getRsrq() {
+                return rsrq;
             }
 
-            public void setRSRQ(double RSRQ) {
-                this.RSRQ = RSRQ;
+            /**
+             * Set rsrq.
+             * @param rsrq rsrq
+             */
+            public void setRsrq(double rsrq) {
+                this.rsrq = rsrq;
             }
 
+            /**
+             * Get time since last update.
+             *
+             * @return long Time
+             */
             public long getTimesincelastupdate() {
                 return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
             }
 
+            /**
+             * Set time since last update.
+             *
+             * @param timesincelastupdate time since last update
+             */
             public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
                 this.timesincelastupdate = timesincelastupdate;
             }
 
             @Override
             public String toString() {
-                return "RX{" +
-                        "RSRP=" + RSRP +
-                        ", RSRQ=" + RSRQ +
-                        ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+                return "rx{" +
+                        "rsrp=" + rsrp +
+                        ", rsrq=" + rsrq +
+                        ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+                        timesincelastupdate.unixTimestamp()) +
                         '}';
             }
         }
 
         @JsonPropertyOrder({
-                "Hist",
-                "Mode",
-                "Mean",
+                "hist",
+                "mode",
+                "mean",
                 "timesincelastupdate"
         })
         @JsonIgnoreProperties(ignoreUnknown = true)
-        public static class CQI {
-            RadioRepPerServCell.CqiHist Hist;
-            double Mode;
-            double Mean;
+        public static class Cqi {
+            RadioRepPerServCell.CqiHist hist;
+            double mode;
+            double mean;
             WallClockTimestamp timesincelastupdate;
 
             @JsonCreator
-            public CQI(@JsonProperty("Hist") RadioRepPerServCell.CqiHist hist, @JsonProperty("Mode") double mode, @JsonProperty("Mean") double mean) {
-                Hist = hist;
-                Mode = mode;
-                Mean = mean;
+            public Cqi(@JsonProperty("hist") RadioRepPerServCell.CqiHist hist, @JsonProperty("mode") double mode,
+                       @JsonProperty("mean") double mean) {
+                this.hist = hist;
+                this.mode = mode;
+                this.mean = mean;
                 this.timesincelastupdate = new WallClockTimestamp();
             }
 
+
+            /**
+             * Get CQIHist.
+             * @return CqiHist
+             */
             public RadioRepPerServCell.CqiHist getHist() {
-                return Hist;
+                return hist;
             }
 
+            /**
+             * Get CQIHist.
+             * @param hist CqiHist
+             */
             public void setHist(RadioRepPerServCell.CqiHist hist) {
-                Hist = hist;
+                this.hist = hist;
             }
 
+            /**
+             * Get mode.
+             * @return double mode
+             */
             public double getMode() {
-                return Mode;
+                return mode;
             }
 
+            /**
+             * Set mode.
+             * @param mode mode
+             */
             public void setMode(double mode) {
-                Mode = mode;
+                this.mode = mode;
             }
 
+            /**
+             * Get mean.
+             * @return double mean
+             */
             public double getMean() {
-                return Mean;
+                return mean;
             }
 
+            /**
+             * Set mean.
+             * @param mean mean
+             */
             public void setMean(double mean) {
-                Mean = mean;
+                this.mean = mean;
             }
 
+            /**
+             * Get time since last update.
+             *
+             * @return long Time
+             */
             public long getTimesincelastupdate() {
                 return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
             }
 
+            /**
+             * Set time since last update.
+             *
+             * @param timesincelastupdate time since last update
+             */
             public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
                 this.timesincelastupdate = timesincelastupdate;
             }
 
             @Override
             public String toString() {
-                return "CQI{" +
-                        "Hist=" + Hist +
-                        ", Mode=" + Mode +
-                        ", Mean=" + Mean +
-                        ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+                return "cqi{" +
+                        "hist=" + hist +
+                        ", mode=" + mode +
+                        ", mean=" + mean +
+                        ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+                        timesincelastupdate.unixTimestamp()) +
                         '}';
             }
         }
@@ -537,48 +725,76 @@
                 "timesincelastupdate"
         })
         @JsonIgnoreProperties(ignoreUnknown = true)
-        public static class MCS {
+        public static class Mcs {
             SchedMeasRepPerServCell.McsDl dl;
             SchedMeasRepPerServCell.McsUl ul;
             WallClockTimestamp timesincelastupdate;
 
             @JsonCreator
-            public MCS(@JsonProperty("dl") SchedMeasRepPerServCell.McsDl dl, @JsonProperty("ul") SchedMeasRepPerServCell.McsUl ul) {
+            public Mcs(@JsonProperty("dl") SchedMeasRepPerServCell.McsDl dl,
+                       @JsonProperty("ul") SchedMeasRepPerServCell.McsUl ul) {
                 this.dl = dl;
                 this.ul = ul;
                 this.timesincelastupdate = new WallClockTimestamp();
             }
 
+            /**
+             * Get DL.
+             * @return Dl
+             */
             public SchedMeasRepPerServCell.McsDl getDl() {
                 return dl;
             }
 
+            /**
+             * Set DL.
+             * @param dl DL
+             */
             public void setDl(SchedMeasRepPerServCell.McsDl dl) {
                 this.dl = dl;
             }
 
+            /**
+             * Get UL.
+             * @return Ul
+             */
             public SchedMeasRepPerServCell.McsUl getUl() {
                 return ul;
             }
 
+            /**
+             * Set UL.
+             * @param ul Ul
+             */
             public void setUl(SchedMeasRepPerServCell.McsUl ul) {
                 this.ul = ul;
             }
 
+            /**
+             * Get time since last update.
+             *
+             * @return long Time
+             */
             public long getTimesincelastupdate() {
                 return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
             }
 
+            /**
+             * Set time since last update.
+             *
+             * @param timesincelastupdate time since last update
+             */
             public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
                 this.timesincelastupdate = timesincelastupdate;
             }
 
             @Override
             public String toString() {
-                return "MCS{" +
+                return "mcs{" +
                         "dl=" + dl +
                         ", ul=" + ul +
-                        ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+                        ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+                        timesincelastupdate.unixTimestamp()) +
                         '}';
             }
         }
@@ -590,38 +806,65 @@
             "ul"
     })
     @JsonIgnoreProperties(ignoreUnknown = true)
-    public static class PDCPThroughput {
+    public static class PdcpThroughput {
         WallClockTimestamp timesincelastupdate;
         private PDCPMeasReportPerUe.ThroughputDl dl;
         private PDCPMeasReportPerUe.ThroughputUl ul;
 
         @JsonCreator
-        public PDCPThroughput(@JsonProperty("dl") PDCPMeasReportPerUe.ThroughputDl dl, @JsonProperty("ul") PDCPMeasReportPerUe.ThroughputUl ul) {
+        public PdcpThroughput(@JsonProperty("dl") PDCPMeasReportPerUe.ThroughputDl dl,
+                              @JsonProperty("ul") PDCPMeasReportPerUe.ThroughputUl ul) {
             this.dl = dl;
             this.ul = ul;
             this.timesincelastupdate = new WallClockTimestamp();
         }
 
+        /**
+         * Get DL.
+         * @return Dl
+         */
         public PDCPMeasReportPerUe.ThroughputDl getDl() {
             return dl;
         }
 
+        /**
+         * Set DL.
+         * @param dl DL
+         */
         public void setDl(PDCPMeasReportPerUe.ThroughputDl dl) {
             this.dl = dl;
         }
 
+        /**
+         * Get UL.
+         * @return Ul
+         */
         public PDCPMeasReportPerUe.ThroughputUl getUl() {
             return ul;
         }
 
+        /**
+         * Set UL.
+         * @param ul Ul
+         */
         public void setUl(PDCPMeasReportPerUe.ThroughputUl ul) {
             this.ul = ul;
         }
 
+        /**
+         * Get time since last update.
+         *
+         * @return long Time
+         */
         public long getTimesincelastupdate() {
             return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
         }
 
+        /**
+         * Set time since last update.
+         *
+         * @param timesincelastupdate time since last update
+         */
         public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
             this.timesincelastupdate = timesincelastupdate;
         }
@@ -629,10 +872,11 @@
         @Override
         public String
         toString() {
-            return "PDCPThroughput{" +
+            return "PdcpThroughput{" +
                     "dl=" + dl +
                     ", ul=" + ul +
-                    ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+                    ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+                    timesincelastupdate.unixTimestamp()) +
                     '}';
         }
     }
@@ -642,48 +886,76 @@
             "ul"
     })
     @JsonIgnoreProperties(ignoreUnknown = true)
-    public static class PDCPPacketDelay {
+    public static class PdcpPacketdelay {
         PDCPMeasReportPerUe.PktDelayDl dl;
         PDCPMeasReportPerUe.PktDelayUl ul;
         WallClockTimestamp timesincelastupdate;
 
         @JsonCreator
-        public PDCPPacketDelay(@JsonProperty("dl") PDCPMeasReportPerUe.PktDelayDl dl, @JsonProperty("ul") PDCPMeasReportPerUe.PktDelayUl ul) {
+        public PdcpPacketdelay(@JsonProperty("dl") PDCPMeasReportPerUe.PktDelayDl dl,
+                               @JsonProperty("ul") PDCPMeasReportPerUe.PktDelayUl ul) {
             this.dl = dl;
             this.ul = ul;
             this.timesincelastupdate = new WallClockTimestamp();
         }
 
+        /**
+         * Get DL.
+         * @return Dl
+         */
         public PDCPMeasReportPerUe.PktDelayDl getDl() {
             return dl;
         }
 
+        /**
+         * Set DL.
+         * @param dl DL
+         */
         public void setDl(PDCPMeasReportPerUe.PktDelayDl dl) {
             this.dl = dl;
         }
 
+        /**
+         * Get UL.
+         * @return Ul
+         */
         public PDCPMeasReportPerUe.PktDelayUl getUl() {
             return ul;
         }
 
+        /**
+         * Set UL.
+         * @param ul Ul
+         */
         public void setUl(PDCPMeasReportPerUe.PktDelayUl ul) {
             this.ul = ul;
         }
 
+        /**
+         * Get time since last update.
+         *
+         * @return long Time
+         */
         public long getTimesincelastupdate() {
             return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
         }
 
+        /**
+         * Set time since last update.
+         *
+         * @param timesincelastupdate time since last update
+         */
         public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
             this.timesincelastupdate = timesincelastupdate;
         }
 
         @Override
         public String toString() {
-            return "PDCPPacketDelay{" +
+            return "PdcpPacketdelay{" +
                     "dl=" + dl +
                     ", ul=" + ul +
-                    ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+                    ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+                    timesincelastupdate.unixTimestamp()) +
                     '}';
         }
     }
@@ -699,32 +971,59 @@
         WallClockTimestamp timesincelastupdate;
 
         @JsonCreator
-        public ResourceUsage(@JsonProperty("dl") PRBUsage.PrbUsageDl dl, @JsonProperty("ul") PRBUsage.PrbUsageUl ul) {
+        public ResourceUsage(@JsonProperty("dl") PRBUsage.PrbUsageDl dl,
+                             @JsonProperty("ul") PRBUsage.PrbUsageUl ul) {
             this.dl = dl;
             this.ul = ul;
             this.timesincelastupdate = new WallClockTimestamp();
         }
 
+        /**
+         * Get DL.
+         * @return Dl
+         */
         public PRBUsage.PrbUsageDl getDl() {
             return dl;
         }
 
+        /**
+         * Set DL.
+         * @param dl DL
+         */
         public void setDl(PRBUsage.PrbUsageDl dl) {
             this.dl = dl;
         }
 
+        /**
+         * Get UL.
+         * @return Ul
+         */
         public PRBUsage.PrbUsageUl getUl() {
             return ul;
         }
 
+        /**
+         * Set UL.
+         * @param ul Ul
+         */
         public void setUl(PRBUsage.PrbUsageUl ul) {
             this.ul = ul;
         }
 
+        /**
+         * Get time since last update.
+         *
+         * @return long Time
+         */
         public long getTimesincelastupdate() {
             return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
         }
 
+        /**
+         * Set time since last update.
+         *
+         * @param timesincelastupdate time since last update
+         */
         public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
             this.timesincelastupdate = timesincelastupdate;
         }
@@ -734,7 +1033,8 @@
             return "ResourceUsage{" +
                     "dl=" + dl +
                     ", ul=" + ul +
-                    ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+                    ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+                    timesincelastupdate.unixTimestamp()) +
                     '}';
         }
     }
diff --git a/src/main/java/org.onosproject.xran/entities/RnibSlice.java b/src/main/java/org.onosproject.xran/entities/RnibSlice.java
index 92e1d98..33cea1b 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibSlice.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibSlice.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.
diff --git a/src/main/java/org.onosproject.xran/entities/RnibUe.java b/src/main/java/org.onosproject.xran/entities/RnibUe.java
index 3afcb04..2d6b605 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibUe.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibUe.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.
@@ -38,7 +38,7 @@
 import static org.onosproject.net.HostId.hostId;
 
 /**
- * Created by dimitris on 7/22/17.
+ * R-NIB UE and its properties.
  */
 @JsonPropertyOrder({
         "ID",
@@ -82,6 +82,11 @@
         timer = new Timer();
     }
 
+    /**
+     * Convert Host ID to UE ID.
+     * @param hostId hostID
+     * @return Long UE ID
+     */
     public static Long hostIdtoUEId(HostId hostId) {
         String mac = hostId.mac().toString();
         mac = mac.replace(":", "");
@@ -89,11 +94,19 @@
         return l;
     }
 
+    /**
+     * Get timer.
+     * @return Timer
+     */
     @JsonIgnore
     public Timer getTimer() {
         return timer;
     }
 
+    /**
+     * Set timer.
+     * @param timer Timer
+     */
     @JsonIgnore
     public void setTimer(Timer timer) {
         this.timer.cancel();
@@ -101,46 +114,82 @@
         this.timer = timer;
     }
 
+    /**
+     * Get MMEUES1APID.
+     * @return MMEUES1APID
+     */
     @JsonProperty("MMEUES1APID")
     public MMEUES1APID getMmeS1apId() {
         return mmeS1apId;
     }
 
+    /**
+     * Set MMEUES1APID.
+     * @param mmeS1apId MMEUES1APID
+     */
     @JsonProperty("MMEUES1APID")
     public void setMmeS1apId(MMEUES1APID mmeS1apId) {
         this.mmeS1apId = mmeS1apId;
     }
 
+    /**
+     * Get ENBUES1APID.
+     * @return ENBUES1APID
+     */
     @JsonProperty("ENBUES1APID")
     public ENBUES1APID getEnbS1apId() {
         return enbS1apId;
     }
 
+    /**
+     * Set ENBUES1APID.
+     * @param enbS1apId ENBUES1APID
+     */
     @JsonProperty("ENBUES1APID")
     public void setEnbS1apId(ENBUES1APID enbS1apId) {
         this.enbS1apId = enbS1apId;
     }
 
+    /**
+     * Get CRNTI.
+     * @return CRNTI
+     */
     @JsonProperty("CRNTI")
     public CRNTI getCrnti() {
         return crnti;
     }
 
+    /**
+     * Set CRNTI.
+     * @param crnti CRNTI
+     */
     @JsonProperty("CRNTI")
     public void setCrnti(CRNTI crnti) {
         this.crnti = crnti;
     }
 
+    /**
+     * Get IMSI.
+     * @return IMSI
+     */
     @JsonProperty("IMSI")
     public String getImsi() {
         return imsi;
     }
 
+    /**
+     * Set IMSI.
+     * @param imsi IMSI
+     */
     @JsonProperty("IMSI")
     public void setImsi(String imsi) {
         this.imsi = imsi;
     }
 
+    /**
+     * Get Host ID.
+     * @return HostId
+     */
     @JsonIgnore
     public HostId getHostId() {
         try {
@@ -180,40 +229,72 @@
         return null;
     }
 
+    /**
+     * Get RXMeasConfig Report.
+     * @return RXSigMeasConfig
+     */
     @JsonProperty("MeasurementConfiguration")
     public RXSigMeasConfig getMeasConfig() {
         return measConfig;
     }
 
+    /**
+     * Set RXMeasConfig Report.
+     * @param measConfig RXSigMeasConfig
+     */
     @JsonProperty("MeasurementConfiguration")
     public void setMeasConfig(RXSigMeasConfig measConfig) {
         this.measConfig = measConfig;
     }
 
+    /**
+     * Get UE Capability Info.
+     * @return UECapabilityInfo
+     */
     @JsonProperty("Capability")
     public UECapabilityInfo getCapability() {
         return capability;
     }
 
+    /**
+     * Set UE Capability Info.
+     * @param capability UECapabilityInfo
+     */
     @JsonProperty("Capability")
     public void setCapability(UECapabilityInfo capability) {
         this.capability = capability;
     }
 
+    /**
+     * Get State.
+     * @return State
+     */
     @JsonProperty("State")
     public State getState() {
         return state;
     }
 
+    /**
+     * Set State.
+     * @param state State
+     */
     @JsonProperty("State")
     public void setState(State state) {
         this.state = state;
     }
 
+    /**
+     * Get UE ID.
+     * @return Long UE ID
+     */
     public Long getId() {
         return id;
     }
 
+    /**
+     * Set UE ID.
+     * @param id Long UE ID
+     */
     public void setId(Long id) {
         this.id = id;
     }
@@ -232,30 +313,48 @@
                 '}';
     }
 
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals()
+     */
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
         RnibUe rnibUe = (RnibUe) o;
         return Objects.equals(id, rnibUe.id);
     }
 
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
     @Override
     public int hashCode() {
         return Objects.hash(id);
     }
 
+
+    /**
+     * Enum of State of UE.
+     */
     public enum State {
         ACTIVE {
             @Override
             public String toString() {
-                return "\"ACTIVE\"";
+                return "ACTIVE";
             }
         },
         IDLE {
             @Override
             public String toString() {
-                return "\"IDLE\"";
+                return "IDLE";
             }
         }
     }
diff --git a/src/main/java/org.onosproject.xran/entities/package-info.java b/src/main/java/org.onosproject.xran/entities/package-info.java
index 6b2c4c4..be85174 100644
--- a/src/main/java/org.onosproject.xran/entities/package-info.java
+++ b/src/main/java/org.onosproject.xran/entities/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.
diff --git a/src/main/java/org.onosproject.xran/identifiers/EcgiCrntiPair.java b/src/main/java/org.onosproject.xran/identifiers/EcgiCrntiPair.java
index 6347788..f12f62a 100644
--- a/src/main/java/org.onosproject.xran/identifiers/EcgiCrntiPair.java
+++ b/src/main/java/org.onosproject.xran/identifiers/EcgiCrntiPair.java
@@ -21,10 +21,13 @@
 import org.onosproject.xran.codecs.api.CRNTI;
 import org.onosproject.xran.codecs.api.ECGI;
 
+/**
+ * Class to maintain pair of ECGI and CRNTI.
+ */
 public class EcgiCrntiPair extends Pair<ECGI, CRNTI> {
 
     /**
-     * Creates a new pair
+     * Creates a new pair.
      *
      * @param key   The key for this pair
      * @param value The value to use for this pair
@@ -33,6 +36,13 @@
         super(key, value);
     }
 
+    /**
+     * Return a new EcgiCrntiPair.
+     *
+     * @param key ECGI
+     * @param value CRNTI
+     * @return EcgiCrntiPair
+     */
     public static EcgiCrntiPair valueOf(ECGI key, CRNTI value) {
         return new EcgiCrntiPair(key, value);
     }
diff --git a/src/main/java/org.onosproject.xran/identifiers/LinkId.java b/src/main/java/org.onosproject.xran/identifiers/LinkId.java
index e2b489a..7bb94f7 100644
--- a/src/main/java/org.onosproject.xran/identifiers/LinkId.java
+++ b/src/main/java/org.onosproject.xran/identifiers/LinkId.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.
@@ -24,12 +24,15 @@
 import org.onosproject.xran.entities.RnibCell;
 import org.onosproject.xran.entities.RnibUe;
 
+/**
+ * Class for LinkId.
+ */
 @JsonPropertyOrder({
         "ECGI",
         "UEID"
 })
 @JsonIgnoreProperties(ignoreUnknown = true)
-public class LinkId {
+public final class LinkId {
     @JsonIgnore
     private RnibCell cell;
     @JsonIgnore
@@ -40,59 +43,108 @@
         this.ue = ue;
     }
 
+    /**
+     * Create new LinkId.
+     * @param cell Cell
+     * @param ue UE
+     * @return new LinkId
+     */
     public static LinkId valueOf(RnibCell cell, RnibUe ue) {
         return new LinkId(cell, ue);
     }
 
-    public static LinkId valueOf(ECGI ecgi, Long UeId) {
+    /**
+     * Create new LinkID with ECGI and UE ID given.
+     * @param ecgi ECGI of new cell
+     * @param ueId UE ID of new UE
+     * @return LinkId
+     */
+    public static LinkId valueOf(ECGI ecgi, Long ueId) {
         RnibCell cell = new RnibCell();
         RnibUe ue = new RnibUe();
 
         cell.setEcgi(ecgi);
-        ue.setId(UeId);
+        ue.setId(ueId);
         return new LinkId(cell, ue);
     }
 
+    /**
+     * Get ECGI.
+     * @return ECGI
+     */
     @JsonProperty("ECGI")
     public ECGI getEcgi() {
         return cell.getEcgi();
     }
 
+    /**
+     * Set ECGI.
+     * @param sourceId ECGI
+     */
     @JsonProperty("ECGI")
     public void setEcgi(ECGI sourceId) {
         cell.setEcgi(sourceId);
     }
 
+    /**
+     * Get UE ID.
+     * @return long UE ID
+     */
     @JsonProperty("UEID")
     public Long getUeId() {
         return ue.getId();
     }
 
+    /**
+     * Set UE ID.
+     * @param destinationId long UE ID
+     */
     @JsonProperty("UEID")
     public void setUeId(Long destinationId) {
         ue.setId(destinationId);
     }
 
+    /**
+     * Get Cell.
+     * @return Cell
+     */
     @JsonIgnore
     public RnibCell getCell() {
         return cell;
     }
 
+    /**
+     * Set Cell.
+     * @param cell Cell
+     */
     @JsonIgnore
     public void setCell(RnibCell cell) {
         this.cell = cell;
     }
 
+    /**
+     * Get UE.
+     * @return UE
+     */
     @JsonIgnore
     public RnibUe getUe() {
         return ue;
     }
 
+    /**
+     * Set UE.
+     * @param ue UE
+     */
     @JsonIgnore
     public void setUe(RnibUe ue) {
         this.ue = ue;
     }
 
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals()
+     */
     @Override
     public boolean equals(Object o) {
         return this == o ||
@@ -103,6 +155,11 @@
 
     }
 
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
     @Override
     public int hashCode() {
         int result = cell.getEcgi().hashCode();
diff --git a/src/main/java/org.onosproject.xran/identifiers/contextUpdateHandler.java b/src/main/java/org.onosproject.xran/identifiers/contextUpdateHandler.java
index 82fdaed..4372d8b 100644
--- a/src/main/java/org.onosproject.xran/identifiers/contextUpdateHandler.java
+++ b/src/main/java/org.onosproject.xran/identifiers/contextUpdateHandler.java
@@ -20,15 +20,27 @@
 import org.onosproject.xran.codecs.pdu.UEAdmissionStatus;
 import org.onosproject.xran.codecs.pdu.UEContextUpdate;
 
-public class contextUpdateHandler {
+/**
+ * Class to handle UE Context Update packet.
+ */
+public class ContextUpdateHandler {
     private UEContextUpdate contextUpdate;
     private UEAdmissionStatus admissionStatus;
     private HOComplete hoComplete;
 
+    /**
+     * Get Context Update.
+     * @return UEContextUpdate
+     */
     public UEContextUpdate getContextUpdate() {
         return contextUpdate;
     }
 
+    /**
+     * Set Context Update.
+     * @param contextUpdate UEContextUpdate
+     * @return boolean to check context update was for admissionStatus packet or HOComplete packet
+     */
     public boolean setContextUpdate(UEContextUpdate contextUpdate) {
         this.contextUpdate = contextUpdate;
 
@@ -36,20 +48,38 @@
 
     }
 
+    /**
+     * Get UEAdmissionStatus.
+     * @return UEAdmissionStatus
+     */
     public UEAdmissionStatus getAdmissionStatus() {
         return admissionStatus;
     }
 
+    /**
+     * Set UEAdmissionStatus.
+     * @param admissionStatus UEAdmissionStatus
+     * @return boolean contextUpdate exists or not
+     */
     public boolean setAdmissionStatus(UEAdmissionStatus admissionStatus) {
         this.admissionStatus = admissionStatus;
 
         return contextUpdate != null;
     }
 
+    /**
+     * Get HOComplete.
+     * @return HOComplete
+     */
     public HOComplete getHoComplete() {
         return hoComplete;
     }
 
+    /**
+     * Set HOComplete.
+     * @param hoComplete HOComplete
+     * @return boolean contextUpdate exists or not
+     */
     public boolean setHoComplete(HOComplete hoComplete) {
         this.hoComplete = hoComplete;
 
@@ -58,7 +88,7 @@
 
     @Override
     public String toString() {
-        return "contextUpdateHandler{" +
+        return "ContextUpdateHandler{" +
                 "contextUpdate=" + (contextUpdate != null) +
                 ", admissionStatus=" + (admissionStatus != null) +
                 ", hoComplete=" + (hoComplete != null) +
diff --git a/src/main/java/org.onosproject.xran/identifiers/package-info.java b/src/main/java/org.onosproject.xran/identifiers/package-info.java
index 421cee2..d375057 100644
--- a/src/main/java/org.onosproject.xran/identifiers/package-info.java
+++ b/src/main/java/org.onosproject.xran/identifiers/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.
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.
diff --git a/src/main/java/org.onosproject.xran/package-info.java b/src/main/java/org.onosproject.xran/package-info.java
index 55d9357..2cb39bf 100644
--- a/src/main/java/org.onosproject.xran/package-info.java
+++ b/src/main/java/org.onosproject.xran/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.
@@ -15,6 +15,6 @@
  */
 
 /**
- * VTN web that used rest to creat vtn resources.
+ * Created by dimitris on 7/20/17.
  */
 package org.onosproject.xran;
diff --git a/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
index af2a24a..a0a5809 100644
--- a/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
+++ b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.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.
@@ -16,10 +16,24 @@
 
 package org.onosproject.xran.providers;
 
-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.onlab.packet.ChassisId;
-import org.onosproject.net.*;
-import org.onosproject.net.device.*;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceProvider;
+import org.onosproject.net.device.DeviceProviderRegistry;
+import org.onosproject.net.device.DeviceProviderService;
 import org.onosproject.net.provider.AbstractProvider;
 import org.onosproject.net.provider.ProviderId;
 import org.onosproject.xran.controller.XranController;
@@ -27,14 +41,12 @@
 import org.slf4j.Logger;
 
 import static org.onosproject.net.DeviceId.deviceId;
-import static org.onosproject.xran.entities.RnibCell.*;
+import static org.onosproject.xran.entities.RnibCell.uri;
 import static org.slf4j.LoggerFactory.getLogger;
 
-
 /**
- * Created by dimitris on 7/27/17.
+ * Cell device provider.
  */
-
 @Component(immediate = true)
 public class CellDeviceProvider extends AbstractProvider implements DeviceProvider {
 
@@ -87,6 +99,9 @@
 
     }
 
+    /**
+     * Internal device listener.
+     */
     private class InternalDeviceListener implements XranDeviceListener {
 
         @Override
@@ -95,6 +110,7 @@
                 return;
             }
 
+            // use ECGI as device ID URI
             DeviceId id = deviceId(uri(cell.getEcgi()));
 
             ChassisId cId = new ChassisId(id.hashCode());
diff --git a/src/main/java/org.onosproject.xran/providers/UeProvider.java b/src/main/java/org.onosproject.xran/providers/UeProvider.java
index 435c78a..e84deb2 100644
--- a/src/main/java/org.onosproject.xran/providers/UeProvider.java
+++ b/src/main/java/org.onosproject.xran/providers/UeProvider.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,9 +17,19 @@
 package org.onosproject.xran.providers;
 
 import com.google.common.collect.Sets;
-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.onlab.packet.VlanId;
-import org.onosproject.net.*;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Host;
+import org.onosproject.net.HostId;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
 import org.onosproject.net.host.DefaultHostDescription;
 import org.onosproject.net.host.HostProvider;
 import org.onosproject.net.host.HostProviderRegistry;
@@ -33,14 +43,13 @@
 
 import java.util.Set;
 
-import static org.onosproject.net.DeviceId.*;
-import static org.onosproject.xran.entities.RnibCell.*;
+import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.xran.entities.RnibCell.uri;
 import static org.slf4j.LoggerFactory.getLogger;
 
 /**
- * Created by dimitris on 7/28/17.
+ * UE Provider.
  */
-
 @Component(immediate = true)
 public class UeProvider extends AbstractProvider implements HostProvider {
 
@@ -78,6 +87,9 @@
 
     }
 
+    /**
+     * Internal host listener.
+     */
     class InternalHostListener implements XranHostListener {
 
         @Override
@@ -94,12 +106,15 @@
             try {
                 Set<HostLocation> hostLocations = Sets.newConcurrentHashSet();
 
-                ecgiSet.forEach(ecgi -> hostLocations.add(new HostLocation(deviceId(uri(ecgi)), PortNumber.portNumber(0), 0)));
+                ecgiSet.forEach(ecgi -> hostLocations
+                        .add(new HostLocation(deviceId(uri(ecgi)),
+                                PortNumber.portNumber(0), 0)));
 
                 SparseAnnotations annotations = DefaultAnnotations.builder()
                         .set(AnnotationKeys.NAME, "UE " + ue.getId())
                         .build();
 
+                // Host ID is calculated from UE ID with some hacky function to represent a MAC address.
                 DefaultHostDescription desc = new DefaultHostDescription(
                         ue.getHostId().mac(),
                         VlanId.vlanId(VlanId.UNTAGGED),
diff --git a/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java b/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
index 01f0e95..10da57e 100644
--- a/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
+++ b/src/main/java/org.onosproject.xran/providers/XranDeviceListener.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.
@@ -20,11 +20,21 @@
 import org.onosproject.xran.entities.RnibCell;
 
 /**
- * Created by dimitris on 7/27/17.
+ * Xran Device Listener.
  */
 public interface XranDeviceListener {
 
+    /**
+     * Add new CELL as a device.
+     *
+     * @param id CELL entity
+     */
     void deviceAdded(RnibCell id);
 
+    /**
+     * Remove CELL.
+     *
+     * @param id CELL ECGI as device id
+     */
     void deviceRemoved(DeviceId id);
 }
diff --git a/src/main/java/org.onosproject.xran/providers/XranHostListener.java b/src/main/java/org.onosproject.xran/providers/XranHostListener.java
index 79676e3..d545018 100644
--- a/src/main/java/org.onosproject.xran/providers/XranHostListener.java
+++ b/src/main/java/org.onosproject.xran/providers/XranHostListener.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.
@@ -23,11 +23,22 @@
 import java.util.Set;
 
 /**
- * Created by dimitris on 7/28/17.
+ * Xran Host Listener.
  */
 public interface XranHostListener {
 
+    /**
+     * Add UE as a host with location the primary link.
+     *
+     * @param ue      UE entity
+     * @param ecgiSet All connected CELLs to this UE
+     */
     void hostAdded(RnibUe ue, Set<ECGI> ecgiSet);
 
+    /**
+     * Remove UE based on Host Id.
+     *
+     * @param id Host Id generated from UE id
+     */
     void hostRemoved(HostId id);
 }
diff --git a/src/main/java/org.onosproject.xran/providers/package-info.java b/src/main/java/org.onosproject.xran/providers/package-info.java
index a3ee964..608d5f6 100644
--- a/src/main/java/org.onosproject.xran/providers/package-info.java
+++ b/src/main/java/org.onosproject.xran/providers/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.
diff --git a/src/main/java/org.onosproject.xran/rest/CellWebResource.java b/src/main/java/org.onosproject.xran/rest/CellWebResource.java
index 86438d5..54accd3 100644
--- a/src/main/java/org.onosproject.xran/rest/CellWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/CellWebResource.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
@@ -22,17 +22,16 @@
 import org.onosproject.xran.XranStore;
 import org.onosproject.xran.annotations.Patch;
 import org.onosproject.xran.controller.XranController;
-import org.onosproject.xran.controller.XranControllerImpl;
 import org.onosproject.xran.entities.RnibCell;
-import org.onosproject.xran.rest.ResponseHelper.statusCode;
+import org.onosproject.xran.rest.ResponseHelper.StatusCode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
+import javax.ws.rs.Consumes;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import java.io.InputStream;
@@ -52,10 +51,10 @@
     }
 
     /**
-     * test.
+     * Lists the cell with {cellid}.
      *
-     * @param eciHex test
-     * @return test
+     * @param eciHex EutranCellIdentifier in binary
+     * @return Response
      */
     @GET
     @Path("{cellid}")
@@ -69,7 +68,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        statusCode.OK,
+                        StatusCode.OK,
                         jsonNode
                 );
 
@@ -80,7 +79,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        statusCode.INTERNAL_SERVER_ERROR,
+                        StatusCode.INTERNAL_SERVER_ERROR,
                         "Exception",
                         fullStackTrace
                 );
@@ -89,18 +88,18 @@
 
         return ResponseHelper.getResponse(
                 mapper(),
-                statusCode.NOT_FOUND,
+                StatusCode.NOT_FOUND,
                 "Not Found",
                 "Cell with " + eciHex + " was not found"
         );
     }
 
     /**
-     * test.
+     * Modify the RRMConfig parameters of the cell.
      *
-     * @param eciHex test
-     * @param stream test (body of request)
-     * @return test
+     * @param eciHex EutranCellIdentifier in binary
+     * @param stream Parameters that you want to modify
+     * @return Response
      */
     @Patch
     @Path("{cellid}")
@@ -116,23 +115,24 @@
                 JsonNode rrmConf = jsonTree.path("RRMConf");
                 if (!rrmConf.isMissingNode()) {
                     final SynchronousQueue<String>[] queue = new SynchronousQueue[1];
-                    get(XranStore.class).modifyCellRrmConf(cell, rrmConf);
+                    get(XranStore.class).modifycellrrmconf(cell, rrmConf);
 
-                    queue[0] = get(XranController.class).sendModifiedRRMConf(cell.getRrmConfig(),
+                    queue[0] = get(XranController.class).sendmodifiedrrmconf(cell.getRrmConfig(),
                             cell.getVersion() <= 3);
-                    String poll = queue[0].poll(get(XranController.class).getNorthbound_timeout(), TimeUnit.MILLISECONDS);
+                    String poll = queue[0].poll(get(XranController.class)
+                            .getNorthboundTimeout(), TimeUnit.MILLISECONDS);
 
                     if (poll != null) {
                         return ResponseHelper.getResponse(
                                 mapper(),
-                                statusCode.OK,
+                                StatusCode.OK,
                                 "Handoff Response",
                                 poll
                         );
                     } else {
                         return ResponseHelper.getResponse(
                                 mapper(),
-                                statusCode.REQUEST_TIMEOUT,
+                                StatusCode.REQUEST_TIMEOUT,
                                 "Handoff Timeout",
                                 "eNodeB did not send a HOComplete/HOFailure on time"
                         );
@@ -141,7 +141,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.BAD_REQUEST,
+                        StatusCode.BAD_REQUEST,
                         "Bad Request",
                         "The command you specified is not implemented or doesn't exist. We support " +
                                 "RRMConf commands."
@@ -153,7 +153,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        statusCode.INTERNAL_SERVER_ERROR,
+                        StatusCode.INTERNAL_SERVER_ERROR,
                         "Exception",
                         fullStackTrace
                 );
@@ -162,7 +162,7 @@
 
         return ResponseHelper.getResponse(
                 mapper(),
-                statusCode.NOT_FOUND,
+                StatusCode.NOT_FOUND,
                 "Not Found",
                 "Cell " + eciHex + " was not found"
         );
diff --git a/src/main/java/org.onosproject.xran/rest/LinkWebResource.java b/src/main/java/org.onosproject.xran/rest/LinkWebResource.java
index 20780b3..420d7b4 100644
--- a/src/main/java/org.onosproject.xran/rest/LinkWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/LinkWebResource.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
@@ -15,7 +15,6 @@
  */
 package org.onosproject.xran.rest;
 
-import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Lists;
@@ -23,23 +22,22 @@
 import org.onosproject.rest.AbstractWebResource;
 import org.onosproject.xran.XranStore;
 import org.onosproject.xran.annotations.Patch;
+import org.onosproject.xran.codecs.ber.types.BerInteger;
 import org.onosproject.xran.controller.XranController;
-import org.onosproject.xran.controller.XranControllerImpl;
 import org.onosproject.xran.entities.RnibCell;
 import org.onosproject.xran.entities.RnibLink;
 import org.onosproject.xran.entities.RnibUe;
-import org.onosproject.xran.codecs.ber.types.BerInteger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.Consumes;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
-import javax.ws.rs.POST;
 import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.POST;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import java.io.InputStream;
@@ -62,11 +60,11 @@
     }
 
     /**
-     * test.
+     * List all the links originating or terminating at cell/UE OR list the link connecting between cell and UE.
      *
-     * @param eciHex test
-     * @param ue     test
-     * @return test
+     * @param eciHex EutranCellIdentifier in binary
+     * @param ue     UE ID
+     * @return Response
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -74,14 +72,14 @@
                                     @DefaultValue("-1") @QueryParam("ue") long ue) {
         List<RnibLink> list = Lists.newArrayList();
         if (!eciHex.isEmpty() && ue != -1) {
-            RnibLink link = get(XranStore.class).getLinkBetweenCellIdUeId(eciHex, ue);
+            RnibLink link = get(XranStore.class).getlinkbetweencellidueid(eciHex, ue);
             if (link != null) {
                 list.add(link);
             }
         } else if (!eciHex.isEmpty()) {
-            list.addAll(get(XranStore.class).getLinksByCellId(eciHex));
+            list.addAll(get(XranStore.class).getlinksbycellid(eciHex));
         } else if (ue != -1) {
-            list.addAll(get(XranStore.class).getLinksByUeId(ue));
+            list.addAll(get(XranStore.class).getlinksbyueid(ue));
         } else {
             list.addAll(get(XranStore.class).getLinks());
         }
@@ -92,7 +90,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.OK,
+                        ResponseHelper.StatusCode.OK,
                         jsonNode
                 );
             } catch (Exception e) {
@@ -102,7 +100,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+                        ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
                         "Exception",
                         fullStackTrace
                 );
@@ -111,49 +109,52 @@
 
         return ResponseHelper.getResponse(
                 mapper(),
-                ResponseHelper.statusCode.NOT_FOUND,
+                ResponseHelper.StatusCode.NOT_FOUND,
                 "Not Found",
                 "Specified links not found"
         );
     }
 
     /**
-     * test.
+     * Modify the link.
      *
-     * @param src    test
-     * @param dst    test
-     * @param stream test
-     * @return test
+     * @param src    CELL ECI in binary
+     * @param dst    UE ID
+     * @param stream Parameter on basis of which link is to be modified
+     * @return Response
      */
     @Patch
     @Path("{src},{dst}")
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
     public Response patchLinks(@PathParam("src") String src, @PathParam("dst") long dst, InputStream stream) {
-        RnibLink link = get(XranStore.class).getLinkBetweenCellIdUeId(src, dst);
+        RnibLink link = get(XranStore.class).getlinkbetweencellidueid(src, dst);
         if (link != null) {
             try {
                 ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
 
+                // Modify link based on Type
                 JsonNode type = jsonTree.path("type");
                 if (!type.isMissingNode()) {
                     RnibLink.Type anEnum = RnibLink.Type.getEnum(type.asText());
                     return handleTypeChange(link, anEnum);
                 }
 
+                // Modify link based on traffic percent
                 JsonNode trafficpercent = jsonTree.path("trafficpercent");
                 if (!trafficpercent.isMissingNode()) {
                     return handleTrafficChange(link, trafficpercent);
                 }
 
+                // Modify link based on RRMConf
                 JsonNode rrmConf = jsonTree.path("RRMConf");
                 if (!rrmConf.isMissingNode()) {
-                    return handleRRMChange(link, rrmConf);
+                    return handleRrmChange(link, rrmConf);
                 }
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.NOT_IMPLEMENTED,
+                        ResponseHelper.StatusCode.NOT_IMPLEMENTED,
                         "Not Implemented",
                         "The command you specified is not implemented or doesn't exist. We support " +
                                 "type/RRMConf/traficpercent commands."
@@ -166,7 +167,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+                        ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
                         "Exception",
                         fullStackTrace
                 );
@@ -175,19 +176,19 @@
 
         return ResponseHelper.getResponse(
                 mapper(),
-                ResponseHelper.statusCode.NOT_FOUND,
+                ResponseHelper.StatusCode.NOT_FOUND,
                 "Not Found",
                 "Link not found use POST request"
         );
     }
 
     /**
-     * test.
+     * Create link based on Type of the link.
      *
-     * @param src    test
-     * @param dst    test
-     * @param stream test
-     * @return test
+     * @param src    CELL ECI in binary
+     * @param dst    UE ID
+     * @param stream LinkType
+     * @return Response
      */
     @POST
     @Path("{src},{dst}")
@@ -200,7 +201,7 @@
         if (cell == null) {
             return ResponseHelper.getResponse(
                     mapper(),
-                    ResponseHelper.statusCode.NOT_FOUND,
+                    ResponseHelper.StatusCode.NOT_FOUND,
                     "Not Found",
                     "Cell " + src + " was not found"
             );
@@ -209,7 +210,7 @@
         if (ue == null) {
             return ResponseHelper.getResponse(
                     mapper(),
-                    ResponseHelper.statusCode.NOT_FOUND,
+                    ResponseHelper.StatusCode.NOT_FOUND,
                     "Not Found",
                     "Ue with " + dst + " was not found"
             );
@@ -218,7 +219,7 @@
         if (get(XranStore.class).getLink(cell.getEcgi(), ue.getId()) != null) {
             return ResponseHelper.getResponse(
                     mapper(),
-                    ResponseHelper.statusCode.BAD_REQUEST,
+                    ResponseHelper.StatusCode.BAD_REQUEST,
                     "Bad Request",
                     "Link already exists use PATCH to modify"
             );
@@ -243,7 +244,7 @@
 
             JsonNode rrmConf = jsonTree.path("RRMConf");
             if (!rrmConf.isMissingNode()) {
-                return handleRRMChange(link, rrmConf);
+                return handleRrmChange(link, rrmConf);
             }
 
         } catch (Exception e) {
@@ -253,7 +254,7 @@
 
             return ResponseHelper.getResponse(
                     mapper(),
-                    ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+                    ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
                     "Exception",
                     fullStackTrace
             );
@@ -261,22 +262,34 @@
 
         return ResponseHelper.getResponse(
                 mapper(),
-                ResponseHelper.statusCode.BAD_REQUEST,
+                ResponseHelper.StatusCode.BAD_REQUEST,
                 "Bad Request",
-                "The command you specified is not implemented or doesn't exist. We support " +
+                "The command you specified is not implemented " +
+                        "or doesn't exist. We support " +
                         "type/RRMConf/traficpercent commands."
         );
     }
 
-    private Response handleTypeChange(RnibLink link, RnibLink.Type newType) throws InterruptedException {
+
+    /**
+     * Change link based on type of the link.
+     *
+     * @param link    Link
+     * @param newType LinkType
+     * @return Response
+     * @throws InterruptedException Interrupted queue
+     */
+    private Response handleTypeChange(RnibLink link, RnibLink.Type newType)
+            throws InterruptedException {
         final SynchronousQueue<String>[] queue = new SynchronousQueue[1];
 
+
         if (newType.equals(RnibLink.Type.SERVING_PRIMARY)) {
             switch (link.getType()) {
                 case SERVING_PRIMARY: {
                     return ResponseHelper.getResponse(
                             mapper(),
-                            ResponseHelper.statusCode.BAD_REQUEST,
+                            ResponseHelper.StatusCode.BAD_REQUEST,
                             "Bad Request",
                             "Link is already a primary link"
                     );
@@ -284,26 +297,28 @@
                 case SERVING_SECONDARY_CA:
                 case SERVING_SECONDARY_DC:
                 case NON_SERVING: {
-                    List<RnibLink> linksByUeId = get(XranStore.class).getLinksByUeId(link.getLinkId().getUeId());
+                    List<RnibLink> linksByUeId = get(XranStore.class)
+                            .getlinksbyueid(link.getLinkId().getUeId());
 
                     Optional<RnibLink> primary = linksByUeId.stream()
                             .filter(l -> l.getType().equals(RnibLink.Type.SERVING_PRIMARY))
                             .findFirst();
                     if (primary.isPresent()) {
                         queue[0] = get(XranController.class).sendHORequest(link, primary.get());
-                        String poll = queue[0].poll(get(XranController.class).getNorthbound_timeout(), TimeUnit.MILLISECONDS);
+                        String poll = queue[0].poll(get(XranController.class)
+                                .getNorthboundTimeout(), TimeUnit.MILLISECONDS);
 
                         if (poll != null) {
                             return ResponseHelper.getResponse(
                                     mapper(),
-                                    ResponseHelper.statusCode.OK,
+                                    ResponseHelper.StatusCode.OK,
                                     "Handoff Response",
                                     poll
                             );
                         } else {
                             return ResponseHelper.getResponse(
                                     mapper(),
-                                    ResponseHelper.statusCode.REQUEST_TIMEOUT,
+                                    ResponseHelper.StatusCode.REQUEST_TIMEOUT,
                                     "Handoff Timeout",
                                     "eNodeB did not send a HOComplete/HOFailure on time"
                             );
@@ -312,93 +327,110 @@
                         link.setType(RnibLink.Type.SERVING_PRIMARY);
                         return ResponseHelper.getResponse(
                                 mapper(),
-                                ResponseHelper.statusCode.OK,
+                                ResponseHelper.StatusCode.OK,
                                 "OK",
                                 "Link set to primary"
                         );
                     }
                 }
+                default:
             }
         } else if (newType.equals(RnibLink.Type.NON_SERVING)) {
             switch (link.getType()) {
-                case NON_SERVING:
+                case NON_SERVING: {
                     return ResponseHelper.getResponse(
                             mapper(),
-                            ResponseHelper.statusCode.BAD_REQUEST,
+                            ResponseHelper.StatusCode.BAD_REQUEST,
                             "Bad Request",
                             "Link is already a primary link"
                     );
-                case SERVING_PRIMARY:
+                }
+                case SERVING_PRIMARY: {
                     return ResponseHelper.getResponse(
                             mapper(),
-                            ResponseHelper.statusCode.BAD_REQUEST,
+                            ResponseHelper.StatusCode.BAD_REQUEST,
                             "Bad Request",
                             "Cannot modify a primary link"
                     );
+                }
                 case SERVING_SECONDARY_CA:
-                case SERVING_SECONDARY_DC:
+                case SERVING_SECONDARY_DC: {
                     if (get(XranController.class).sendScellDelete(link)) {
                         return ResponseHelper.getResponse(
                                 mapper(),
-                                ResponseHelper.statusCode.OK,
+                                ResponseHelper.StatusCode.OK,
                                 "OK",
                                 "Link set to non-serving"
                         );
                     } else {
                         return ResponseHelper.getResponse(
                                 mapper(),
-                                ResponseHelper.statusCode.NOT_FOUND,
+                                ResponseHelper.StatusCode.NOT_FOUND,
                                 "Not Found",
                                 "Could not find cell config report to construct Scell Delete"
                         );
                     }
+                }
+                default:
             }
         } else if (newType.equals(RnibLink.Type.SERVING_SECONDARY_CA)) {
             switch (link.getType()) {
-                case SERVING_PRIMARY:
+                case SERVING_PRIMARY: {
                     return ResponseHelper.getResponse(
                             mapper(),
-                            ResponseHelper.statusCode.BAD_REQUEST,
+                            ResponseHelper.StatusCode.BAD_REQUEST,
                             "Bad Request",
                             "Cannot modify a primary link"
                     );
+                }
                 case SERVING_SECONDARY_DC:
-                case NON_SERVING:
+                case NON_SERVING: {
                     queue[0] = get(XranController.class).sendScellAdd(link);
-                    String poll = queue[0].poll(get(XranController.class).getNorthbound_timeout(), TimeUnit.MILLISECONDS);
+                    String poll = queue[0].poll(get(XranController.class)
+                            .getNorthboundTimeout(), TimeUnit.MILLISECONDS);
                     if (poll != null) {
                         return ResponseHelper.getResponse(
                                 mapper(),
-                                ResponseHelper.statusCode.OK,
+                                ResponseHelper.StatusCode.OK,
                                 "ScellAdd Response",
                                 poll
                         );
                     } else {
                         return ResponseHelper.getResponse(
                                 mapper(),
-                                ResponseHelper.statusCode.REQUEST_TIMEOUT,
+                                ResponseHelper.StatusCode.REQUEST_TIMEOUT,
                                 "ScellAdd Timeout",
                                 "eNodeB did not send a ScellAddStatus on time"
                         );
                     }
-                case SERVING_SECONDARY_CA:
+                }
+                case SERVING_SECONDARY_CA: {
                     return ResponseHelper.getResponse(
                             mapper(),
-                            ResponseHelper.statusCode.BAD_REQUEST,
+                            ResponseHelper.StatusCode.BAD_REQUEST,
                             "Bad Request",
                             "Link is already a secondary CA link"
                     );
+                }
+                default:
             }
         }
 
         return ResponseHelper.getResponse(
                 mapper(),
-                ResponseHelper.statusCode.BAD_REQUEST,
+                ResponseHelper.StatusCode.BAD_REQUEST,
                 "Bad Request",
                 "The command you specified is not implemented or doesn't exist."
         );
     }
 
+    /**
+     * Modify link based on the traffic percent.
+     *
+     * @param link           Link
+     * @param trafficpercent Traffic Percent of the link to be modified
+     * @return Response
+     */
     private Response handleTrafficChange(RnibLink link, JsonNode trafficpercent) {
         JsonNode jsonNode = trafficpercent.path("traffic-percent-dl");
         if (!jsonNode.isMissingNode()) {
@@ -412,41 +444,49 @@
 
         return ResponseHelper.getResponse(
                 mapper(),
-                ResponseHelper.statusCode.OK,
+                ResponseHelper.StatusCode.OK,
                 "OK",
                 "Traffic Percent changed"
         );
     }
 
-    private Response handleRRMChange(RnibLink link, JsonNode rrmConf) throws InterruptedException {
+    /**
+     * Modify link based on RRMConf parameters.
+     *
+     * @param link    Link
+     * @param rrmConf RRMConfig of the Link to be modified
+     * @return Response
+     * @throws InterruptedException Interrupted queue
+     */
+    private Response handleRrmChange(RnibLink link, JsonNode rrmConf) throws InterruptedException {
         final SynchronousQueue<String>[] queue = new SynchronousQueue[1];
-        get(XranStore.class).modifyLinkRrmConf(link, rrmConf);
-        boolean isxICIC = link.getLinkId().getCell().getVersion() <= 3;
+        get(XranStore.class).modifylinkrrmconf(link, rrmConf);
+        boolean isxicic = link.getLinkId().getCell().getVersion() <= 3;
 
-        queue[0] = get(XranController.class).sendModifiedRRMConf(link.getRrmParameters(),
-                isxICIC);
+        queue[0] = get(XranController.class).sendmodifiedrrmconf(link.getRrmParameters(),
+                isxicic);
 
-        if (isxICIC) {
+        if (isxicic) {
             return ResponseHelper.getResponse(
                     mapper(),
-                    ResponseHelper.statusCode.OK,
+                    ResponseHelper.StatusCode.OK,
                     "OK",
                     "xICIC was sent successfully"
             );
         } else {
-            String poll = queue[0].poll(get(XranController.class).getNorthbound_timeout(), TimeUnit.MILLISECONDS);
+            String poll = queue[0].poll(get(XranController.class).getNorthboundTimeout(), TimeUnit.MILLISECONDS);
 
             if (poll != null) {
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.OK,
+                        ResponseHelper.StatusCode.OK,
                         "RRMConfig Response",
                         poll
                 );
             } else {
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.REQUEST_TIMEOUT,
+                        ResponseHelper.StatusCode.REQUEST_TIMEOUT,
                         "RRMConfig Timeout",
                         "eNodeB did not send a RRMConfingStatus on time"
                 );
diff --git a/src/main/java/org.onosproject.xran/rest/NodeWebResource.java b/src/main/java/org.onosproject.xran/rest/NodeWebResource.java
index 2b9124c..961ed19 100644
--- a/src/main/java/org.onosproject.xran/rest/NodeWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/NodeWebResource.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
@@ -15,24 +15,20 @@
  */
 package org.onosproject.xran.rest;
 
-import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.collect.Lists;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.exception.ExceptionUtils;
 import org.onosproject.rest.AbstractWebResource;
 import org.onosproject.xran.XranStore;
-import org.onosproject.xran.entities.RnibCell;
-import org.onosproject.xran.entities.RnibUe;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import java.util.List;
@@ -51,10 +47,10 @@
     }
 
     /**
-     * test.
+     * List all the nodes in the R-NIB.
      *
-     * @param type test
-     * @return test
+     * @param type Type of node (cell/ue)
+     * @return Response
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -62,16 +58,17 @@
         JsonNode jsonNode;
         try {
             List<Object> nodes;
+            // List cell type of nodes or UE type of nodes.
             if (StringUtils.isBlank(type)) {
                 nodes = get(XranStore.class).getNodes();
             } else if (type.equals("cell")) {
-                nodes = get(XranStore.class).getCellNodes();
+                nodes = get(XranStore.class).getcellnodes();
             } else if (type.equals("ue")) {
-                nodes = get(XranStore.class).getUeNodes();
+                nodes = get(XranStore.class).getuenodes();
             } else {
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.NOT_FOUND,
+                        ResponseHelper.StatusCode.NOT_FOUND,
                         "Not Found",
                         "Type of node was not found"
                 );
@@ -80,7 +77,7 @@
             if (nodes.size() == 0) {
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.NOT_FOUND,
+                        ResponseHelper.StatusCode.NOT_FOUND,
                         "Not Found",
                         "No nodes found"
                 );
@@ -94,7 +91,7 @@
 
             return ResponseHelper.getResponse(
                     mapper(),
-                    ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+                    ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
                     "Exception",
                     fullStackTrace
             );
@@ -102,22 +99,22 @@
 
         return ResponseHelper.getResponse(
                 mapper(),
-                ResponseHelper.statusCode.OK,
+                ResponseHelper.StatusCode.OK,
                 jsonNode
         );
     }
 
     /**
-     * test.
+     * List the node with a specific node id.
      *
-     * @param nodeid test
-     * @return test
+     * @param nodeid ID of the node
+     * @return Response
      */
     @GET
     @Path("{nodeid}")
     @Produces(MediaType.APPLICATION_JSON)
     public Response getNodeid(@PathParam("nodeid") String nodeid) {
-        Object node = get(XranStore.class).getByNodeId(nodeid);
+        Object node = get(XranStore.class).getbynodeid(nodeid);
 
         if (node != null) {
             try {
@@ -125,7 +122,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.OK,
+                        ResponseHelper.StatusCode.OK,
                         jsonNode
                 );
             } catch (Exception e) {
@@ -135,7 +132,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+                        ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
                         "Exception",
                         fullStackTrace
                 );
@@ -144,7 +141,7 @@
 
         return ResponseHelper.getResponse(
                 mapper(),
-                ResponseHelper.statusCode.NOT_FOUND,
+                ResponseHelper.StatusCode.NOT_FOUND,
                 "Not Found",
                 "Node " + nodeid + " was not found"
         );
diff --git a/src/main/java/org.onosproject.xran/rest/ResponseHelper.java b/src/main/java/org.onosproject.xran/rest/ResponseHelper.java
index 5e2f1dd..f037cee 100644
--- a/src/main/java/org.onosproject.xran/rest/ResponseHelper.java
+++ b/src/main/java/org.onosproject.xran/rest/ResponseHelper.java
@@ -23,9 +23,15 @@
 
 import javax.ws.rs.core.Response;
 
-public class ResponseHelper {
+/**
+ * Various types of responses.
+ */
+public final class ResponseHelper {
 
-    public static Response getResponse(ObjectMapper mapper, statusCode status, String title, String detail) {
+    private ResponseHelper() {
+    }
+
+    public static Response getResponse(ObjectMapper mapper, StatusCode status, String title, String detail) {
         ObjectNode rootNode = mapper.createObjectNode();
 
         switch (status) {
@@ -58,7 +64,7 @@
         }
     }
 
-    public static Response getResponse(ObjectMapper mapper, statusCode status, JsonNode node) {
+    public static Response getResponse(ObjectMapper mapper, StatusCode status, JsonNode node) {
         ObjectNode rootNode = mapper.createObjectNode();
 
         switch (status) {
@@ -79,7 +85,7 @@
         }
     }
 
-    public enum statusCode {
+    public enum StatusCode {
         OK(200),
         BAD_REQUEST(400),
         NOT_FOUND(404),
@@ -89,7 +95,7 @@
 
         public int status;
 
-        statusCode(int status) {
+        StatusCode(int status) {
             this.status = status;
         }
     }
diff --git a/src/main/java/org.onosproject.xran/rest/SliceWebResource.java b/src/main/java/org.onosproject.xran/rest/SliceWebResource.java
index 58b4bef..8817be8 100644
--- a/src/main/java/org.onosproject.xran/rest/SliceWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/SliceWebResource.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
@@ -15,7 +15,6 @@
  */
 package org.onosproject.xran.rest;
 
-import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.JsonNode;
 import org.apache.commons.lang.exception.ExceptionUtils;
 import org.onosproject.rest.AbstractWebResource;
@@ -32,7 +31,6 @@
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import java.io.IOException;
 import java.io.InputStream;
 
 /**
@@ -49,10 +47,10 @@
     }
 
     /**
-     * test.
+     * List the slice with the given slice ID.
      *
-     * @param sliceid test
-     * @return test
+     * @param sliceid ID of the slice
+     * @return Response
      */
     @GET
     @Path("{sliceid}")
@@ -66,7 +64,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.OK,
+                        ResponseHelper.StatusCode.OK,
                         jsonNode
                 );
             } catch (Exception e) {
@@ -76,7 +74,7 @@
 
                 return ResponseHelper.getResponse(
                         mapper(),
-                        ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+                        ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
                         "Exception",
                         fullStackTrace
                 );
@@ -85,17 +83,17 @@
 
         return ResponseHelper.getResponse(
                 mapper(),
-                ResponseHelper.statusCode.NOT_FOUND,
+                ResponseHelper.StatusCode.NOT_FOUND,
                 "Not Found",
                 "Slice " + sliceid + " not found"
         );
     }
 
     /**
-     * test.
+     * Create slice with the corresponding attributes.
      *
-     * @param stream test
-     * @return test
+     * @param stream Attributes to create slice
+     * @return Response
      */
     @POST
     @Consumes(MediaType.APPLICATION_JSON)
@@ -108,7 +106,7 @@
             // FIXME: change when implemented
             return ResponseHelper.getResponse(
                     mapper(),
-                    ResponseHelper.statusCode.NOT_IMPLEMENTED,
+                    ResponseHelper.StatusCode.NOT_IMPLEMENTED,
                     "Not Implemented",
                     "POST Slice not implemented"
             );
@@ -119,7 +117,7 @@
 
             return ResponseHelper.getResponse(
                     mapper(),
-                    ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+                    ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
                     "Exception",
                     fullStackTrace
             );
diff --git a/src/main/java/org.onosproject.xran/rest/XranWebApplication.java b/src/main/java/org.onosproject.xran/rest/XranWebApplication.java
index 30f584b..fff752f 100644
--- a/src/main/java/org.onosproject.xran/rest/XranWebApplication.java
+++ b/src/main/java/org.onosproject.xran/rest/XranWebApplication.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/src/main/java/org.onosproject.xran/rest/package-info.java b/src/main/java/org.onosproject.xran/rest/package-info.java
index 16f0c2f..c08814c 100644
--- a/src/main/java/org.onosproject.xran/rest/package-info.java
+++ b/src/main/java/org.onosproject.xran/rest/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/src/main/java/org.onosproject.xran/wrapper/CellMap.java b/src/main/java/org.onosproject.xran/wrapper/CellMap.java
index ea4fc77..6685189 100644
--- a/src/main/java/org.onosproject.xran/wrapper/CellMap.java
+++ b/src/main/java/org.onosproject.xran/wrapper/CellMap.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,20 +19,22 @@
 import com.google.common.collect.BiMap;
 import com.google.common.collect.HashBiMap;
 import io.netty.channel.ChannelHandlerContext;
-import org.onosproject.net.DeviceId;
 import org.onosproject.xran.XranStore;
 import org.onosproject.xran.codecs.api.ECGI;
 import org.onosproject.xran.codecs.api.PCIARFCN;
 import org.onosproject.xran.entities.RnibCell;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+/**
+ * CELL wrapper to help put/get/remove.
+ */
 public class CellMap {
+    // map to get the context channel based on ecgi
     private ConcurrentMap<ECGI, ChannelHandlerContext> ecgiCtx = new ConcurrentHashMap<>();
 
+    // pci-arfcn to ecgi bimap
     private BiMap<PCIARFCN, ECGI> pciarfcnMap = HashBiMap.create();
     private XranStore xranStore;
 
@@ -40,13 +42,22 @@
         this.xranStore = xranStore;
     }
 
+    /**
+     * Put the PCI-ARFCN to ECGI map from new cell.
+     *
+     * @param value CELL entity
+     */
     public void putPciArfcn(RnibCell value) {
-        PCIARFCN pciarfcn = new PCIARFCN();
-        pciarfcn.setPci(value.getConf().getPci());
-        pciarfcn.setEarfcnDl(value.getConf().getEarfcnDl());
+        PCIARFCN pciarfcn = PCIARFCN.valueOf(value.getConf().getPci(), value.getConf().getEarfcnDl());
         pciarfcnMap.put(pciarfcn, value.getEcgi());
     }
 
+    /**
+     * Put inside ECGI to CTX map.
+     *
+     * @param value CELL entity to get ECGI from
+     * @param ctx   context channel
+     */
     public void put(RnibCell value, ChannelHandlerContext ctx) {
         if (value.getEcgi() != null) {
             ecgiCtx.put(value.getEcgi(), ctx);
@@ -54,8 +65,14 @@
         }
     }
 
+    /**
+     * Get cell based on PCI-ARFCN.
+     *
+     * @param id PCI-ARFCN
+     * @return CELL entity if found
+     */
     public RnibCell get(PCIARFCN id) {
-        ECGI ecgi = null;
+        ECGI ecgi;
         ecgi = pciarfcnMap.get(id);
 
         if (ecgi != null) {
@@ -64,6 +81,12 @@
         return null;
     }
 
+    /**
+     * Get cell based on ECGI.
+     *
+     * @param ecgi CELL ECGI
+     * @return CELL entity if found
+     */
     public RnibCell get(ECGI ecgi) {
         if (ecgi != null) {
             return xranStore.getCell(ecgi);
@@ -71,6 +94,12 @@
         return null;
     }
 
+    /**
+     * Remove cell from three maps based on ECGI or PCI-ARFCN.
+     *
+     * @param key ecgECGIi or pci-arfcn of cell to remove
+     * @return true if remove succeeded
+     */
     public boolean remove(Object key) {
         ECGI ecgi = null;
         if (key instanceof ECGI) {
@@ -87,6 +116,12 @@
         return ecgi != null && xranStore.removeCell(ecgi);
     }
 
+    /**
+     * Get context handler for specified ECGI.
+     *
+     * @param id CELL ECGI
+     * @return context handler if found
+     */
     public ChannelHandlerContext getCtx(ECGI id) {
         return ecgiCtx.get(id);
     }
diff --git a/src/main/java/org.onosproject.xran/wrapper/LinkMap.java b/src/main/java/org.onosproject.xran/wrapper/LinkMap.java
index ed7b4f1..543879d 100644
--- a/src/main/java/org.onosproject.xran/wrapper/LinkMap.java
+++ b/src/main/java/org.onosproject.xran/wrapper/LinkMap.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.
@@ -29,6 +29,9 @@
 
 import static org.slf4j.LoggerFactory.getLogger;
 
+/**
+ * LINK wrapper to help put/get/remove.
+ */
 public class LinkMap {
     private static final Logger log = getLogger(LinkMap.class);
 
@@ -41,14 +44,28 @@
         this.ueMap = ueMap;
     }
 
+    /**
+     * Put a new primary link between a CELL and a UE.
+     *
+     * @param cell CELL entity
+     * @param ue   UE entity
+     */
     public void putPrimaryLink(RnibCell cell, RnibUe ue) {
         RnibLink link = new RnibLink(cell, ue);
+        // set link to primary before storing
         link.setType(RnibLink.Type.SERVING_PRIMARY);
         xranStore.storeLink(link);
 
         ueMap.putCrnti(cell, ue);
     }
 
+    /**
+     * Put non-serving link based on CELL and CRNTI.
+     *
+     * @param cell  CELL entity
+     * @param crnti CRNTI
+     * @return new link after creation
+     */
     public RnibLink putNonServingLink(RnibCell cell, CRNTI crnti) {
         RnibLink link = null;
         RnibUe ue = ueMap.get(cell.getEcgi(), crnti);
@@ -62,6 +79,13 @@
         return link;
     }
 
+    /**
+     * Put non-serving link based on CELL and UE id.
+     *
+     * @param cell CELL entity
+     * @param ueId UE id
+     * @return new link after creation
+     */
     public RnibLink putNonServingLink(RnibCell cell, Long ueId) {
         RnibLink link = null;
         RnibUe ue = ueMap.get(ueId);
@@ -75,6 +99,13 @@
         return link;
     }
 
+    /**
+     * Get link based on ECGI and UE id.
+     *
+     * @param src CELL ECGI
+     * @param dst UE ID
+     * @return link if found
+     */
     public RnibLink get(ECGI src, Long dst) {
         if (src != null && dst != null) {
             return xranStore.getLink(src, dst);
@@ -82,6 +113,13 @@
         return null;
     }
 
+    /**
+     * Get link based on ECGI and CRNTI.
+     *
+     * @param src CELL ECGI
+     * @param dst CELL unique CRNTI
+     * @return link if found
+     */
     public RnibLink get(ECGI src, CRNTI dst) {
         RnibUe ue = ueMap.get(src, dst);
 
@@ -91,12 +129,27 @@
         return null;
     }
 
+    /**
+     * Get CRNTI based on UE id.
+     *
+     * @param ueId UE id
+     * @return UE if found
+     */
     public CRNTI getCrnti(Long ueId) {
         return ueMap.getCrntUe().inverse().get(ueId).getValue();
     }
 
+    /**
+     * Get primary CELL for specified UE.
+     *
+     * @param ue UE entity
+     * @return primary CELL if found
+     */
     public RnibCell getPrimaryCell(RnibUe ue) {
-        List<RnibLink> linksByUeId = xranStore.getLinksByUeId(ue.getId());
+        List<RnibLink> linksByUeId = xranStore.getlinksbyueid(ue.getId());
+
+        // TODO: search for primary link from crntUe in UeMap because it has the primary links only!
+        // search all links for this UE and find PRIMARY.
         Optional<RnibLink> primary = linksByUeId.stream()
                 .filter(l -> l.getType().equals(RnibLink.Type.SERVING_PRIMARY))
                 .findFirst();
diff --git a/src/main/java/org.onosproject.xran/wrapper/UeMap.java b/src/main/java/org.onosproject.xran/wrapper/UeMap.java
index 8b2110d..6ebab70 100644
--- a/src/main/java/org.onosproject.xran/wrapper/UeMap.java
+++ b/src/main/java/org.onosproject.xran/wrapper/UeMap.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.
@@ -21,12 +21,15 @@
 import org.onosproject.xran.XranStore;
 import org.onosproject.xran.codecs.api.CRNTI;
 import org.onosproject.xran.codecs.api.ECGI;
-import org.onosproject.xran.codecs.api.MMEUES1APID;
 import org.onosproject.xran.entities.RnibCell;
 import org.onosproject.xran.entities.RnibUe;
 import org.onosproject.xran.identifiers.EcgiCrntiPair;
 
+/**
+ * UE wrapper to help put/get/remove.
+ */
 public class UeMap {
+    // ECGI, CRNTI pair of primary cell for specified UE.
     private BiMap<EcgiCrntiPair, Long> crntUe = HashBiMap.create();
 
     private XranStore xranStore;
@@ -35,30 +38,58 @@
         this.xranStore = xranStore;
     }
 
+    /**
+     * Get the ECGI, CRNTI to UE bimap.
+     *
+     * @return BiMap of EcgiCrntiPair to Long
+     */
     public BiMap<EcgiCrntiPair, Long> getCrntUe() {
         return crntUe;
     }
 
+    /**
+     * Put new ECGI, CRNTI pair of primary link to UE and remove old one.
+     *
+     * @param cell new primary CELL
+     * @param ue   UE
+     */
     public void putCrnti(RnibCell cell, RnibUe ue) {
-        CRNTI ranId = ue.getCrnti();
+        CRNTI crnti = ue.getCrnti();
         ECGI ecgi = cell.getEcgi();
-        if (ranId != null && ecgi != null) {
+
+        if (crnti != null && ecgi != null) {
+            // check if there is an ecgi, crnti pair for this UE id.
             EcgiCrntiPair oldPair = crntUe.inverse().get(ue.getId()),
                     newPair = EcgiCrntiPair.valueOf(cell.getEcgi(), ue.getCrnti());
             if (oldPair == null) {
                 crntUe.put(newPair, ue.getId());
             } else {
+                // remove old pair and add the new pair which corresponds to the primary cell.
                 crntUe.inverse().remove(ue.getId());
                 crntUe.put(newPair, ue.getId());
             }
         }
     }
 
+    /**
+     * Put new UE to the store and update the ECGI, CRNTI pair.
+     *
+     * @param cell new primary CELL
+     * @param ue   UE
+     */
     public void put(RnibCell cell, RnibUe ue) {
         xranStore.storeUe(ue);
+        // after adding new primary cell update the bimap as well.
         putCrnti(cell, ue);
     }
 
+    /**
+     * Get UE based on ECGI and CRNTI.
+     *
+     * @param ecgi  CELL ECGI
+     * @param crnti CELL unique CRNTI
+     * @return UE entity if found
+     */
     public RnibUe get(ECGI ecgi, CRNTI crnti) {
         Long aLong = crntUe.get(EcgiCrntiPair.valueOf(ecgi, crnti));
         if (aLong != null) {
@@ -67,10 +98,22 @@
         return null;
     }
 
+    /**
+     * Get UE based on its id.
+     *
+     * @param ueId UE id
+     * @return UE entity if found
+     */
     public RnibUe get(Long ueId) {
         return xranStore.getUe(ueId);
     }
 
+    /**
+     * Remove UE based on its id.
+     *
+     * @param ueId UE id
+     * @return true if remove succeeded
+     */
     public boolean remove(Long ueId) {
         crntUe.inverse().remove(ueId);
         return xranStore.removeUe(ueId);
diff --git a/src/main/java/org.onosproject.xran/wrapper/package-info.java b/src/main/java/org.onosproject.xran/wrapper/package-info.java
index c724c32..7718d8e 100644
--- a/src/main/java/org.onosproject.xran/wrapper/package-info.java
+++ b/src/main/java/org.onosproject.xran/wrapper/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.
@@ -14,4 +14,7 @@
  * limitations under the License.
  */
 
+/**
+ * Created by dimitris on 7/20/17.
+ */
 package org.onosproject.xran.wrapper;
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index f0919ca..4520f46 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  ~ Copyright 2016-present Open Networking Laboratory
+  ~ Copyright 2016-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.
