diff --git a/cmd/openonu-adapter/main.go b/cmd/openonu-adapter/main.go
index b472c2e..0b91e79 100644
--- a/cmd/openonu-adapter/main.go
+++ b/cmd/openonu-adapter/main.go
@@ -45,7 +45,7 @@
 )
 
 type adapter struct {
-	defaultAppName   string
+	//defaultAppName   string
 	instanceID       string
 	config           *config.AdapterFlags
 	iAdapter         adapters.IAdapter // from Voltha interface adapters
@@ -422,9 +422,8 @@
 		content, err := ioutil.ReadFile("VERSION")
 		if err == nil {
 			return (string(content))
-		} else {
-			logger.Error("'VERSION'-file not readable")
 		}
+		logger.Error("'VERSION'-file not readable")
 	}
 	return version.VersionInfo.Version
 }
@@ -508,17 +507,17 @@
 
 	realMain() //fatal on httpListen(0,6060) ...
 
-	defer log.CleanUp()
-
+	defer func() {
+		_ = log.CleanUp()
+	}()
 	// Print version / build information and exit
 	if cf.DisplayVersionOnly {
 		printVersion(defaultAppName)
 		return
-	} else {
-		logger.Infow("config", log.Fields{"StartName": defaultAppName})
-		logger.Infow("config", log.Fields{"BuildVersion": version.VersionInfo.String("  ")})
-		logger.Infow("config", log.Fields{"Arguments": os.Args[1:]})
 	}
+	logger.Infow("config", log.Fields{"StartName": defaultAppName})
+	logger.Infow("config", log.Fields{"BuildVersion": version.VersionInfo.String("  ")})
+	logger.Infow("config", log.Fields{"Arguments": os.Args[1:]})
 
 	// Print banner if specified
 	if cf.Banner {
diff --git a/internal/pkg/onuadaptercore/common.go b/internal/pkg/onuadaptercore/common.go
index ed55bbd..f4d7e06 100644
--- a/internal/pkg/onuadaptercore/common.go
+++ b/internal/pkg/onuadaptercore/common.go
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-//Package core Common Logger initialization
+//Package adaptercoreonu provides the utility for onu devices, flows and statistics
 package adaptercoreonu
 
 import (
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index 395b369..91b794c 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -70,17 +70,17 @@
 
 //Event category and subcategory definitions - same as defiend for OLT in eventmgr.go  - should be done more centrally
 const (
-	pon           = voltha.EventSubCategory_PON
-	olt           = voltha.EventSubCategory_OLT
-	ont           = voltha.EventSubCategory_ONT
-	onu           = voltha.EventSubCategory_ONU
-	nni           = voltha.EventSubCategory_NNI
-	service       = voltha.EventCategory_SERVICE
-	security      = voltha.EventCategory_SECURITY
-	equipment     = voltha.EventCategory_EQUIPMENT
-	processing    = voltha.EventCategory_PROCESSING
-	environment   = voltha.EventCategory_ENVIRONMENT
-	communication = voltha.EventCategory_COMMUNICATION
+	pon = voltha.EventSubCategory_PON
+	//olt           = voltha.EventSubCategory_OLT
+	//ont           = voltha.EventSubCategory_ONT
+	//onu           = voltha.EventSubCategory_ONU
+	//nni           = voltha.EventSubCategory_NNI
+	//service       = voltha.EventCategory_SERVICE
+	//security      = voltha.EventCategory_SECURITY
+	equipment = voltha.EventCategory_EQUIPMENT
+	//processing    = voltha.EventCategory_PROCESSING
+	//environment   = voltha.EventCategory_ENVIRONMENT
+	//communication = voltha.EventCategory_COMMUNICATION
 )
 
 const (
@@ -99,7 +99,7 @@
 	logicalDeviceID  string
 	ProxyAddressID   string
 	ProxyAddressType string
-	parentId         string
+	parentID         string
 	ponPortNumber    uint32
 
 	coreProxy    adapterif.CoreProxy
@@ -108,7 +108,7 @@
 
 	pOpenOnuAc      *OpenONUAC
 	pDeviceStateFsm *fsm.FSM
-	pPonPort        *voltha.Port
+	//pPonPort        *voltha.Port
 	deviceEntrySet  chan bool //channel for DeviceEntry set event
 	pOnuOmciDevice  *OnuDeviceEntry
 	pOnuTP          *OnuUniTechProf
@@ -184,18 +184,20 @@
 	return &dh
 }
 
-// start save the device to the data model
+// Start save the device to the data model
 func (dh *DeviceHandler) Start(ctx context.Context) {
 	logger.Debugw("starting-device-handler", log.Fields{"device": dh.device, "device-id": dh.deviceID})
 	// Add the initial device to the local model
 	logger.Debug("device-handler-started")
 }
 
+/*
 // stop stops the device dh.  Not much to do for now
 func (dh *DeviceHandler) stop(ctx context.Context) {
 	logger.Debug("stopping-device-handler")
 	dh.exitChannel <- 1
 }
+*/
 
 // ##########################################################################################
 // DeviceHandler methods that implement the adapters interface requests ##### begin #########
@@ -248,34 +250,33 @@
 			pDevEntry := dh.GetOnuDeviceEntry(true)
 			if pDevEntry != nil {
 				return pDevEntry.PDevOmciCC.ReceiveMessage(context.TODO(), omciMsg.Message)
-			} else {
-				logger.Errorw("No valid OnuDevice -aborting", log.Fields{"device-id": dh.deviceID})
-				return errors.New("No valid OnuDevice")
 			}
+			logger.Errorw("No valid OnuDevice -aborting", log.Fields{"device-id": dh.deviceID})
+			return errors.New("no valid OnuDevice")
 		}
 	case ic.InterAdapterMessageType_ONU_IND_REQUEST:
 		{
 			msgBody := msg.GetBody()
-			onu_indication := &oop.OnuIndication{}
-			if err := ptypes.UnmarshalAny(msgBody, onu_indication); err != nil {
+			onuIndication := &oop.OnuIndication{}
+			if err := ptypes.UnmarshalAny(msgBody, onuIndication); err != nil {
 				logger.Warnw("cannot-unmarshal-onu-indication-msg-body", log.Fields{
 					"device-id": dh.deviceID, "error": err})
 				return err
 			}
 
-			onu_operstate := onu_indication.GetOperState()
-			logger.Debugw("inter-adapter-recv-onu-ind", log.Fields{"OnuId": onu_indication.GetOnuId(),
-				"AdminState": onu_indication.GetAdminState(), "OperState": onu_operstate,
-				"SNR": onu_indication.GetSerialNumber()})
+			onuOperstate := onuIndication.GetOperState()
+			logger.Debugw("inter-adapter-recv-onu-ind", log.Fields{"OnuId": onuIndication.GetOnuId(),
+				"AdminState": onuIndication.GetAdminState(), "OperState": onuOperstate,
+				"SNR": onuIndication.GetSerialNumber()})
 
 			//interface related functions might be error checked ....
-			if onu_operstate == "up" {
-				dh.create_interface(onu_indication)
-			} else if (onu_operstate == "down") || (onu_operstate == "unreachable") {
-				dh.updateInterface(onu_indication)
+			if onuOperstate == "up" {
+				_ = dh.createInterface(onuIndication)
+			} else if (onuOperstate == "down") || (onuOperstate == "unreachable") {
+				_ = dh.updateInterface(onuIndication)
 			} else {
-				logger.Errorw("unknown-onu-indication operState", log.Fields{"OnuId": onu_indication.GetOnuId()})
-				return errors.New("InvalidOperState")
+				logger.Errorw("unknown-onu-indication operState", log.Fields{"OnuId": onuIndication.GetOnuId()})
+				return errors.New("invalidOperState")
 			}
 		}
 	case ic.InterAdapterMessageType_TECH_PROFILE_DOWNLOAD_REQUEST:
@@ -284,7 +285,7 @@
 				//should normally not happen ...
 				logger.Warnw("onuTechProf instance not set up for DLMsg request - ignoring request",
 					log.Fields{"device-id": dh.deviceID})
-				return errors.New("TechProfile DLMsg request while onuTechProf instance not setup")
+				return errors.New("techProfile DLMsg request while onuTechProf instance not setup")
 			}
 			if (dh.deviceReason == "stopping-openomci") || (dh.deviceReason == "omci-admin-lock") {
 				// I've seen cases for this request, where the device was already stopped
@@ -304,7 +305,7 @@
 			// even to fast subsequent calls of the same messageType
 			dh.pOnuTP.lockTpProcMutex()
 			// lock hangs as long as below decoupled or other related TechProfile processing is active
-			if bTpModify := dh.pOnuTP.updateOnuUniTpPath(techProfMsg.UniId, techProfMsg.Path); bTpModify == true {
+			if bTpModify := dh.pOnuTP.updateOnuUniTpPath(techProfMsg.UniId, techProfMsg.Path); bTpModify {
 				//	if there has been some change for some uni TechProfilePath
 				//in order to allow concurrent calls to other dh instances we do not wait for execution here
 				//but doing so we can not indicate problems to the caller (who does what with that then?)
@@ -338,7 +339,7 @@
 				//should normally not happen ...
 				logger.Warnw("onuTechProf instance not set up for DelGem request - ignoring request",
 					log.Fields{"device-id": dh.deviceID})
-				return errors.New("TechProfile DelGem request while onuTechProf instance not setup")
+				return errors.New("techProfile DelGem request while onuTechProf instance not setup")
 			}
 
 			msgBody := msg.GetBody()
@@ -371,7 +372,7 @@
 				//should normally not happen ...
 				logger.Warnw("onuTechProf instance not set up for DelTcont request - ignoring request",
 					log.Fields{"device-id": dh.deviceID})
-				return errors.New("TechProfile DelTcont request while onuTechProf instance not setup")
+				return errors.New("techProfile DelTcont request while onuTechProf instance not setup")
 			}
 
 			msgBody := msg.GetBody()
@@ -384,7 +385,7 @@
 
 			//compare TECH_PROFILE_DOWNLOAD_REQUEST
 			dh.pOnuTP.lockTpProcMutex()
-			if bTpModify := dh.pOnuTP.updateOnuUniTpPath(delTcontMsg.UniId, ""); bTpModify == true {
+			if bTpModify := dh.pOnuTP.updateOnuUniTpPath(delTcontMsg.UniId, ""); bTpModify {
 				// deadline context to ensure completion of background routines waited for
 				deadline := time.Now().Add(10 * time.Second) //allowed run time to finish before execution
 				dctx, cancel := context.WithDeadline(context.Background(), deadline)
@@ -538,12 +539,12 @@
 		dh.reconciling = false
 		return
 	}
-	var onu_indication oop.OnuIndication
-	onu_indication.IntfId = dh.pOnuTP.sOnuPersistentData.PersIntfID
-	onu_indication.OnuId = dh.pOnuTP.sOnuPersistentData.PersOnuID
-	onu_indication.OperState = dh.pOnuTP.sOnuPersistentData.PersOperState
-	onu_indication.AdminState = dh.pOnuTP.sOnuPersistentData.PersAdminState
-	dh.create_interface(&onu_indication)
+	var onuIndication oop.OnuIndication
+	onuIndication.IntfId = dh.pOnuTP.sOnuPersistentData.PersIntfID
+	onuIndication.OnuId = dh.pOnuTP.sOnuPersistentData.PersOnuID
+	onuIndication.OperState = dh.pOnuTP.sOnuPersistentData.PersOperState
+	onuIndication.AdminState = dh.pOnuTP.sOnuPersistentData.PersAdminState
+	_ = dh.createInterface(&onuIndication)
 }
 
 func (dh *DeviceHandler) ReconcileDeviceTechProf() {
@@ -569,7 +570,7 @@
 		// attention: deadline completion check and wg.Done is to be done in both routines
 		go dh.pOnuTP.configureUniTp(dctx, uint8(uniData.PersUniId), uniData.PersTpPath, &wg)
 		//the wait.. function is responsible for tpProcMutex.Unlock()
-		dh.pOnuTP.waitForTpCompletion(cancel, &wg) //wait for background process to finish and collect their result
+		_ = dh.pOnuTP.waitForTpCompletion(cancel, &wg) //wait for background process to finish and collect their result
 		return
 	}
 	dh.pOnuTP.unlockTpProcMutex()
@@ -592,7 +593,11 @@
 		logger.Errorw("device-unreachable", log.Fields{"device-id": device.Id, "SerialNumber": device.SerialNumber})
 		return errors.New("device-unreachable")
 	}
-	dh.pOnuOmciDevice.Reboot(context.TODO())
+	if err := dh.pOnuOmciDevice.Reboot(context.TODO()); err != nil {
+		//TODO with VOL-3045/VOL-3046: return the error and stop further processing
+		logger.Errorw("error-rebooting-device", log.Fields{"device-id": dh.deviceID, "error": err})
+		return err
+	}
 	if err := dh.coreProxy.DeviceStateUpdate(context.TODO(), dh.deviceID, voltha.ConnectStatus_UNREACHABLE,
 		voltha.OperStatus_DISCOVERED); err != nil {
 		//TODO with VOL-3045/VOL-3046: return the error and stop further processing
@@ -634,13 +639,13 @@
 	dh.logicalDeviceID = dh.deviceID // really needed - what for ??? //TODO!!!
 
 	if !dh.reconciling {
-		dh.coreProxy.DeviceUpdate(context.TODO(), dh.device)
+		_ = dh.coreProxy.DeviceUpdate(context.TODO(), dh.device)
 	} else {
 		logger.Debugw("reconciling - don't notify core about DeviceUpdate",
 			log.Fields{"device-id": dh.deviceID})
 	}
 
-	dh.parentId = dh.device.ParentId
+	dh.parentID = dh.device.ParentId
 	dh.ponPortNumber = dh.device.ParentPortNo
 
 	// store proxy parameters for later communication - assumption: invariant, else they have to be requested dynamically!!
@@ -648,7 +653,7 @@
 	dh.ProxyAddressType = dh.device.ProxyAddress.GetDeviceType()
 	logger.Debugw("device-updated", log.Fields{"device-id": dh.deviceID, "proxyAddressID": dh.ProxyAddressID,
 		"proxyAddressType": dh.ProxyAddressType, "SNR": dh.device.SerialNumber,
-		"ParentId": dh.parentId, "ParentPortNo": dh.ponPortNumber})
+		"ParentId": dh.parentID, "ParentPortNo": dh.ponPortNumber})
 
 	/*
 		self._pon = PonPort.create(self, self._pon_port_number)
@@ -671,7 +676,7 @@
 			Label:      fmt.Sprintf("pon-%d", ponPortNo),
 			Type:       voltha.Port_PON_ONU,
 			OperStatus: voltha.OperStatus_ACTIVE,
-			Peers: []*voltha.Port_PeerPort{{DeviceId: dh.parentId, // Peer device  is OLT
+			Peers: []*voltha.Port_PeerPort{{DeviceId: dh.parentID, // Peer device  is OLT
 				PortNo: ponPortNo}}, // Peer port is parent's port number
 		}
 		if err = dh.coreProxy.PortCreated(context.TODO(), dh.deviceID, pPonPort); err != nil {
@@ -758,22 +763,18 @@
 func (dh *DeviceHandler) doStateConnected(e *fsm.Event) {
 
 	logger.Debug("doStateConnected-started")
-	var err error
-	err = errors.New("Device FSM: function not implemented yet!")
+	err := errors.New("device FSM: function not implemented yet")
 	e.Cancel(err)
 	logger.Debug("doStateConnected-done")
-	return
 }
 
 // doStateUp handle the onu up indication and update to voltha core
 func (dh *DeviceHandler) doStateUp(e *fsm.Event) {
 
 	logger.Debug("doStateUp-started")
-	var err error
-	err = errors.New("Device FSM: function not implemented yet!")
+	err := errors.New("device FSM: function not implemented yet")
 	e.Cancel(err)
 	logger.Debug("doStateUp-done")
-	return
 
 	/*
 		// Synchronous call to update device state - this method is run in its own go routine
@@ -844,10 +845,9 @@
 		logger.Debugw("do-state-down-end", log.Fields{"deviceID": device.Id})
 		return nil
 	*/
-	err = errors.New("Device FSM: function not implemented yet!")
+	err = errors.New("device FSM: function not implemented yet")
 	e.Cancel(err)
 	logger.Debug("doStateDown-done")
-	return
 }
 
 // DeviceHandler StateMachine related state transition methods ##### end #########
@@ -882,12 +882,11 @@
 
 //SetOnuDeviceEntry sets the ONU device entry within the handler
 func (dh *DeviceHandler) SetOnuDeviceEntry(
-	apDeviceEntry *OnuDeviceEntry, apOnuTp *OnuUniTechProf) error {
+	apDeviceEntry *OnuDeviceEntry, apOnuTp *OnuUniTechProf) {
 	dh.lockDevice.Lock()
 	defer dh.lockDevice.Unlock()
 	dh.pOnuOmciDevice = apDeviceEntry
 	dh.pOnuTP = apOnuTp
-	return nil
 }
 
 //AddOnuDeviceEntry creates a new ONU device or returns the existing
@@ -918,7 +917,7 @@
 }
 
 // doStateInit provides the device update to the core
-func (dh *DeviceHandler) create_interface(onuind *oop.OnuIndication) error {
+func (dh *DeviceHandler) createInterface(onuind *oop.OnuIndication) error {
 	logger.Debugw("create_interface-started", log.Fields{"OnuId": onuind.GetOnuId(),
 		"OnuIntfId": onuind.GetIntfId(), "OnuSerialNumber": onuind.GetSerialNumber()})
 
@@ -950,10 +949,12 @@
 
 	pDevEntry := dh.GetOnuDeviceEntry(true)
 	if pDevEntry != nil {
-		pDevEntry.Start(context.TODO())
+		if err := pDevEntry.Start(context.TODO()); err != nil {
+			return err
+		}
 	} else {
 		logger.Errorw("No valid OnuDevice -aborting", log.Fields{"device-id": dh.deviceID})
-		return errors.New("No valid OnuDevice")
+		return errors.New("no valid OnuDevice")
 	}
 	if !dh.reconciling {
 		if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "starting-openomci"); err != nil {
@@ -968,10 +969,10 @@
 
 	/* this might be a good time for Omci Verify message?  */
 	verifyExec := make(chan bool)
-	omci_verify := NewOmciTestRequest(context.TODO(),
+	omciVerify := NewOmciTestRequest(context.TODO(),
 		dh.device.Id, pDevEntry.PDevOmciCC,
 		true, true) //eclusive and allowFailure (anyway not yet checked)
-	omci_verify.PerformOmciTest(context.TODO(), verifyExec)
+	omciVerify.PerformOmciTest(context.TODO(), verifyExec)
 
 	/* 	give the handler some time here to wait for the OMCi verification result
 	after Timeout start and try MibUpload FSM anyway
@@ -1059,7 +1060,7 @@
 	/* Note: Even though FSM calls look 'synchronous' here, FSM is running in background with the effect that possible errors
 	 * 	 within the MibUpload are not notified in the OnuIndication response, this might be acceptable here,
 	 *   as further OltAdapter processing may rely on the deviceReason event 'MibUploadDone' as a result of the FSM processing
-	 *   otherwise some processing synchronisation would be required - cmp. e.g TechProfile processing
+	 *   otherwise some processing synchronization would be required - cmp. e.g TechProfile processing
 	 */
 	//call MibUploadFSM - transition up to state ulStInSync
 	pMibUlFsm := pDevEntry.pMibUploadFsm.pFsm
@@ -1067,25 +1068,27 @@
 		if pMibUlFsm.Is(ulStDisabled) {
 			if err := pMibUlFsm.Event(ulEvStart); err != nil {
 				logger.Errorw("MibSyncFsm: Can't go to state starting", log.Fields{"err": err})
-				return errors.New("Can't go to state starting")
-			} else {
-				logger.Debugw("MibSyncFsm", log.Fields{"state": string(pMibUlFsm.Current())})
-				//Determine ONU status and start/re-start MIB Synchronization tasks
-				//Determine if this ONU has ever synchronized
-				if true { //TODO: insert valid check
-					if err := pMibUlFsm.Event(ulEvResetMib); err != nil {
-						logger.Errorw("MibSyncFsm: Can't go to state resetting_mib", log.Fields{"err": err})
-						return errors.New("Can't go to state resetting_mib")
-					}
-				} else {
-					pMibUlFsm.Event(ulEvExamineMds)
-					logger.Debugw("state of MibSyncFsm", log.Fields{"state": string(pMibUlFsm.Current())})
-					//Examine the MIB Data Sync
-					// callbacks to be handled:
-					// Event(ulEvSuccess)
-					// Event(ulEvTimeout)
-					// Event(ulEvMismatch)
+				return errors.New("can't go to state starting")
+			}
+			logger.Debugw("MibSyncFsm", log.Fields{"state": string(pMibUlFsm.Current())})
+			//Determine ONU status and start/re-start MIB Synchronization tasks
+			//Determine if this ONU has ever synchronized
+			if true { //TODO: insert valid check
+				if err := pMibUlFsm.Event(ulEvResetMib); err != nil {
+					logger.Errorw("MibSyncFsm: Can't go to state resetting_mib", log.Fields{"err": err})
+					return errors.New("can't go to state resetting_mib")
 				}
+			} else {
+				if err := pMibUlFsm.Event(ulEvExamineMds); err != nil {
+					logger.Errorw("MibSyncFsm: Can't go to state examine_mds", log.Fields{"err": err})
+					return errors.New("can't go to examine_mds")
+				}
+				logger.Debugw("state of MibSyncFsm", log.Fields{"state": string(pMibUlFsm.Current())})
+				//Examine the MIB Data Sync
+				// callbacks to be handled:
+				// Event(ulEvSuccess)
+				// Event(ulEvTimeout)
+				// Event(ulEvMismatch)
 			}
 		} else {
 			logger.Errorw("wrong state of MibSyncFsm - want: disabled", log.Fields{"have": string(pMibUlFsm.Current())})
@@ -1106,7 +1109,7 @@
 		pDevEntry := dh.GetOnuDeviceEntry(false)
 		if pDevEntry == nil {
 			logger.Errorw("No valid OnuDevice -aborting", log.Fields{"device-id": dh.deviceID})
-			return errors.New("No valid OnuDevice")
+			return errors.New("no valid OnuDevice")
 		}
 
 		switch dh.deviceReason {
@@ -1114,29 +1117,29 @@
 			{ //MIBSync FSM may run
 				pMibUlFsm := pDevEntry.pMibUploadFsm.pFsm
 				if pMibUlFsm != nil {
-					pMibUlFsm.Event(ulEvStop) //TODO!! verify if MibSyncFsm stop-processing is sufficient (to allow it again afterwards)
+					_ = pMibUlFsm.Event(ulEvStop) //TODO!! verify if MibSyncFsm stop-processing is sufficient (to allow it again afterwards)
 				}
 			}
 		case "discovery-mibsync-complete":
 			{ //MibDownload may run
 				pMibDlFsm := pDevEntry.pMibDownloadFsm.pFsm
 				if pMibDlFsm != nil {
-					pMibDlFsm.Event(dlEvReset)
+					_ = pMibDlFsm.Event(dlEvReset)
 				}
 			}
 		default:
 			{
 				//port lock/unlock FSM's may be active
 				if dh.pUnlockStateFsm != nil {
-					dh.pUnlockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
+					_ = dh.pUnlockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 				}
 				if dh.pLockStateFsm != nil {
-					dh.pLockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
+					_ = dh.pLockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 				}
 				//techProfile related PonAniConfigFsm FSM may be active
 				// maybe encapsulated as OnuTP method - perhaps later in context of module splitting
 				if dh.pOnuTP.pAniConfigFsm != nil {
-					dh.pOnuTP.pAniConfigFsm.pAdaptFsm.pFsm.Event(aniEvReset)
+					_ = dh.pOnuTP.pAniConfigFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 				}
 				for _, uniPort := range dh.uniEntityMap {
 					//reset the TechProfileConfig Done state for all (active) UNI's
@@ -1146,7 +1149,7 @@
 						//VlanFilterFsm exists and was already started
 						pVlanFilterStatemachine := pVlanFilterFsm.pAdaptFsm.pFsm
 						if pVlanFilterStatemachine != nil {
-							pVlanFilterStatemachine.Event(vlanEvReset)
+							_ = pVlanFilterStatemachine.Event(vlanEvReset)
 						}
 					}
 				}
@@ -1154,12 +1157,12 @@
 			//TODO!!! care about PM/Alarm processing once started
 		}
 		//TODO: from here the deviceHandler FSM itself may be stuck in some of the initial states
-		//  (mainly the still seperate 'Event states')
+		//  (mainly the still separate 'Event states')
 		//  so it is questionable, how this is resolved after some possible re-enable
 		//  assumption there is obviously, that the system may continue with some 'after "mib-download-done" state'
 
 		//stop/remove(?) the device entry
-		pDevEntry.Stop(context.TODO()) //maybe some more sophisticated context treatment should be used here?
+		_ = pDevEntry.Stop(context.TODO()) //maybe some more sophisticated context treatment should be used here?
 
 		//TODO!!! remove existing traffic profiles
 		/* from py code, if TP's exist, remove them - not yet implemented
@@ -1197,8 +1200,8 @@
 }
 
 //DeviceProcStatusUpdate evaluates possible processing events and initiates according next activities
-func (dh *DeviceHandler) DeviceProcStatusUpdate(dev_Event OnuDeviceEvent) {
-	switch dev_Event {
+func (dh *DeviceHandler) DeviceProcStatusUpdate(devEvent OnuDeviceEvent) {
+	switch devEvent {
 	case MibDatabaseSync:
 		{
 			logger.Debugw("MibInSync event received", log.Fields{"device-id": dh.deviceID})
@@ -1221,20 +1224,20 @@
 			i := uint8(0) //UNI Port limit: see MaxUnisPerOnu (by now 16) (OMCI supports max 255 p.b.)
 			pDevEntry := dh.GetOnuDeviceEntry(false)
 			if unigInstKeys := pDevEntry.pOnuDB.GetSortedInstKeys(me.UniGClassID); len(unigInstKeys) > 0 {
-				for _, mgmtEntityId := range unigInstKeys {
+				for _, mgmtEntityID := range unigInstKeys {
 					logger.Debugw("Add UNI port for stored UniG instance:", log.Fields{
-						"device-id": dh.deviceID, "UnigMe EntityID": mgmtEntityId})
-					dh.addUniPort(mgmtEntityId, i, UniPPTP)
+						"device-id": dh.deviceID, "UnigMe EntityID": mgmtEntityID})
+					dh.addUniPort(mgmtEntityID, i, UniPPTP)
 					i++
 				}
 			} else {
 				logger.Debugw("No UniG instances found", log.Fields{"device-id": dh.deviceID})
 			}
 			if veipInstKeys := pDevEntry.pOnuDB.GetSortedInstKeys(me.VirtualEthernetInterfacePointClassID); len(veipInstKeys) > 0 {
-				for _, mgmtEntityId := range veipInstKeys {
+				for _, mgmtEntityID := range veipInstKeys {
 					logger.Debugw("Add VEIP acc. to stored VEIP instance:", log.Fields{
-						"device-id": dh.deviceID, "VEIP EntityID": mgmtEntityId})
-					dh.addUniPort(mgmtEntityId, i, UniVEIP)
+						"device-id": dh.deviceID, "VEIP EntityID": mgmtEntityID})
+					dh.addUniPort(mgmtEntityID, i, UniVEIP)
 					i++
 				}
 			} else {
@@ -1390,22 +1393,22 @@
 		}
 	default:
 		{
-			logger.Warnw("unhandled-device-event", log.Fields{"device-id": dh.deviceID, "event": dev_Event})
+			logger.Warnw("unhandled-device-event", log.Fields{"device-id": dh.deviceID, "event": devEvent})
 		}
 	} //switch
 }
 
-func (dh *DeviceHandler) addUniPort(a_uniInstNo uint16, a_uniId uint8, a_portType UniPortType) {
+func (dh *DeviceHandler) addUniPort(aUniInstNo uint16, aUniID uint8, aPortType UniPortType) {
 	// parameters are IntfId, OnuId, uniId
 	uniNo := MkUniPortNum(dh.pOnuIndication.GetIntfId(), dh.pOnuIndication.GetOnuId(),
-		uint32(a_uniId))
+		uint32(aUniID))
 	if _, present := dh.uniEntityMap[uniNo]; present {
-		logger.Warnw("onuUniPort-add: Port already exists", log.Fields{"for InstanceId": a_uniInstNo})
+		logger.Warnw("onuUniPort-add: Port already exists", log.Fields{"for InstanceId": aUniInstNo})
 	} else {
-		//with arguments a_uniId, a_portNo, a_portType
-		pUniPort := NewOnuUniPort(a_uniId, uniNo, a_uniInstNo, a_portType)
+		//with arguments aUniID, a_portNo, aPortType
+		pUniPort := NewOnuUniPort(aUniID, uniNo, aUniInstNo, aPortType)
 		if pUniPort == nil {
-			logger.Warnw("onuUniPort-add: Could not create Port", log.Fields{"for InstanceId": a_uniInstNo})
+			logger.Warnw("onuUniPort-add: Could not create Port", log.Fields{"for InstanceId": aUniInstNo})
 		} else {
 			//store UniPort with the System-PortNumber key
 			dh.uniEntityMap[uniNo] = pUniPort
@@ -1424,7 +1427,7 @@
 // enableUniPortStateUpdate enables UniPortState and update core port state accordingly
 func (dh *DeviceHandler) enableUniPortStateUpdate() {
 	//  py code was updated 2003xx to activate the real ONU UNI ports per OMCI (VEIP or PPTP)
-	//    but towards core only the first port active state is signalled
+	//    but towards core only the first port active state is signaled
 	//    with following remark:
 	//       # TODO: for now only support the first UNI given no requirement for multiple uni yet. Also needed to reduce flow
 	//       #  load on the core
@@ -1463,15 +1466,15 @@
 
 // ONU_Active/Inactive announcement on system KAFKA bus
 // tried to re-use procedure of oltUpDownIndication from openolt_eventmgr.go with used values from Py code
-func (dh *DeviceHandler) sendOnuOperStateEvent(a_OperState vc.OperStatus_Types, a_deviceID string, raisedTs int64) {
+func (dh *DeviceHandler) sendOnuOperStateEvent(aOperState vc.OperStatus_Types, aDeviceID string, raisedTs int64) {
 	var de voltha.DeviceEvent
 	eventContext := make(map[string]string)
 	//Populating event context
 	//  assume giving ParentId in GetDevice twice really gives the ParentDevice (there is no GetParentDevice()...)
-	parentDevice, err := dh.coreProxy.GetDevice(context.TODO(), dh.parentId, dh.parentId)
+	parentDevice, err := dh.coreProxy.GetDevice(context.TODO(), dh.parentID, dh.parentID)
 	if err != nil || parentDevice == nil {
 		logger.Errorw("Failed to fetch parent device for OnuEvent",
-			log.Fields{"parentId": dh.parentId, "err": err})
+			log.Fields{"parentID": dh.parentID, "err": err})
 	}
 	oltSerialNumber := parentDevice.SerialNumber
 
@@ -1479,15 +1482,15 @@
 	eventContext["onu-id"] = strconv.FormatUint(uint64(dh.pOnuIndication.OnuId), 10)
 	eventContext["serial-number"] = dh.device.SerialNumber
 	eventContext["olt_serial_number"] = oltSerialNumber
-	eventContext["device_id"] = a_deviceID
-	eventContext["registration_id"] = a_deviceID //py: string(device_id)??
+	eventContext["device_id"] = aDeviceID
+	eventContext["registration_id"] = aDeviceID //py: string(device_id)??
 	logger.Debugw("prepare ONU_ACTIVATED event",
-		log.Fields{"DeviceId": a_deviceID, "EventContext": eventContext})
+		log.Fields{"DeviceId": aDeviceID, "EventContext": eventContext})
 
 	/* Populating device event body */
 	de.Context = eventContext
-	de.ResourceId = a_deviceID
-	if a_OperState == voltha.OperStatus_ACTIVE {
+	de.ResourceId = aDeviceID
+	if aOperState == voltha.OperStatus_ACTIVE {
 		de.DeviceEventName = fmt.Sprintf("%s_%s", cOnuActivatedEvent, "RAISE_EVENT")
 		de.Description = fmt.Sprintf("%s Event - %s - %s",
 			cEventObjectType, cOnuActivatedEvent, "Raised")
@@ -1499,17 +1502,17 @@
 	/* Send event to KAFKA */
 	if err := dh.EventProxy.SendDeviceEvent(&de, equipment, pon, raisedTs); err != nil {
 		logger.Warnw("could not send ONU_ACTIVATED event",
-			log.Fields{"device-id": a_deviceID, "error": err})
+			log.Fields{"device-id": aDeviceID, "error": err})
 	}
 	logger.Debugw("ONU_ACTIVATED event sent to KAFKA",
-		log.Fields{"device-id": a_deviceID, "with-EventName": de.DeviceEventName})
+		log.Fields{"device-id": aDeviceID, "with-EventName": de.DeviceEventName})
 }
 
-// createUniLockFsm initialises and runs the UniLock FSM to transfer the OMCI related commands for port lock/unlock
+// createUniLockFsm initializes and runs the UniLock FSM to transfer the OMCI related commands for port lock/unlock
 func (dh *DeviceHandler) createUniLockFsm(aAdminState bool, devEvent OnuDeviceEvent) {
 	chLSFsm := make(chan Message, 2048)
 	var sFsmName string
-	if aAdminState == true {
+	if aAdminState {
 		logger.Infow("createLockStateFSM", log.Fields{"device-id": dh.deviceID})
 		sFsmName = "LockStateFSM"
 	} else {
@@ -1525,7 +1528,7 @@
 	pLSFsm := NewLockStateFsm(pDevEntry.PDevOmciCC, aAdminState, devEvent,
 		sFsmName, dh.deviceID, chLSFsm)
 	if pLSFsm != nil {
-		if aAdminState == true {
+		if aAdminState {
 			dh.pLockStateFsm = pLSFsm
 		} else {
 			dh.pUnlockStateFsm = pLSFsm
@@ -1542,19 +1545,19 @@
 	 ***** should run via 'adminDone' state and generate the argument requested event *****
 	 */
 	var pLSStatemachine *fsm.FSM
-	if aAdminState == true {
+	if aAdminState {
 		pLSStatemachine = dh.pLockStateFsm.pAdaptFsm.pFsm
 		//make sure the opposite FSM is not running and if so, terminate it as not relevant anymore
 		if (dh.pUnlockStateFsm != nil) &&
 			(dh.pUnlockStateFsm.pAdaptFsm.pFsm.Current() != uniStDisabled) {
-			dh.pUnlockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
+			_ = dh.pUnlockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 		}
 	} else {
 		pLSStatemachine = dh.pUnlockStateFsm.pAdaptFsm.pFsm
 		//make sure the opposite FSM is not running and if so, terminate it as not relevant anymore
 		if (dh.pLockStateFsm != nil) &&
 			(dh.pLockStateFsm.pAdaptFsm.pFsm.Current() != uniStDisabled) {
-			dh.pLockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
+			_ = dh.pLockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 		}
 	}
 	if pLSStatemachine != nil {
diff --git a/internal/pkg/onuadaptercore/messageTypes.go b/internal/pkg/onuadaptercore/messageTypes.go
index a5d5aff..69b69d5 100644
--- a/internal/pkg/onuadaptercore/messageTypes.go
+++ b/internal/pkg/onuadaptercore/messageTypes.go
@@ -45,8 +45,7 @@
 type TestMessageType uint8
 
 const (
-	noOperation TestMessageType = iota
-	LoadMibTemplateOk
+	LoadMibTemplateOk TestMessageType = iota + 1
 	LoadMibTemplateFailed
 	TimeOutOccurred
 	AbortMessageProcessing
diff --git a/internal/pkg/onuadaptercore/mib_download.go b/internal/pkg/onuadaptercore/mib_download.go
index 58c5c9a..a2e485e 100644
--- a/internal/pkg/onuadaptercore/mib_download.go
+++ b/internal/pkg/onuadaptercore/mib_download.go
@@ -74,7 +74,7 @@
 		// obviously calling some FSM event here directly does not work - so trying to decouple it ...
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event(dlEvReset)
+				_ = a_pAFsm.pFsm.Event(dlEvReset)
 			}
 		}(pMibDlFsm)
 	}
@@ -97,7 +97,7 @@
 		// see DownloadedState: decouple event transfer
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event(dlEvRestart)
+				_ = a_pAFsm.pFsm.Event(dlEvRestart)
 			}
 		}(pMibDlFsm)
 	}
@@ -107,35 +107,35 @@
 	logger.Debugw("Start MibDownload Msg processing", log.Fields{"for device-id": onuDeviceEntry.deviceID})
 loop:
 	for {
-		select {
 		// case <-ctx.Done():
 		// 	logger.Info("MibSync Msg", log.Fields{"Message handling canceled via context for device-id": onuDeviceEntry.deviceID})
 		// 	break loop
-		case message, ok := <-onuDeviceEntry.pMibDownloadFsm.commChan:
-			if !ok {
-				logger.Info("MibDownload Rx Msg", log.Fields{"Message couldn't be read from channel for device-id": onuDeviceEntry.deviceID})
-				// but then we have to ensure a restart of the FSM as well - as exceptional procedure
-				onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRestart)
+		// unless multiple channels are not involved, we should not use select
+		message, ok := <-onuDeviceEntry.pMibDownloadFsm.commChan
+		if !ok {
+			logger.Info("MibDownload Rx Msg", log.Fields{"Message couldn't be read from channel for device-id": onuDeviceEntry.deviceID})
+			// but then we have to ensure a restart of the FSM as well - as exceptional procedure
+			_ = onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRestart)
+			break loop
+		}
+		logger.Debugw("MibDownload Rx Msg", log.Fields{"Received message for device-id": onuDeviceEntry.deviceID})
+
+		switch message.Type {
+		case TestMsg:
+			msg, _ := message.Data.(TestMessage)
+			if msg.TestMessageVal == AbortMessageProcessing {
+				logger.Infow("MibDownload abort ProcessMsg", log.Fields{"for device-id": onuDeviceEntry.deviceID})
 				break loop
 			}
-			logger.Debugw("MibDownload Rx Msg", log.Fields{"Received message for device-id": onuDeviceEntry.deviceID})
-
-			switch message.Type {
-			case TestMsg:
-				msg, _ := message.Data.(TestMessage)
-				if msg.TestMessageVal == AbortMessageProcessing {
-					logger.Infow("MibDownload abort ProcessMsg", log.Fields{"for device-id": onuDeviceEntry.deviceID})
-					break loop
-				}
-				logger.Warnw("MibDownload unknown TestMessage", log.Fields{"device-id": onuDeviceEntry.deviceID, "MessageVal": msg.TestMessageVal})
-			case OMCI:
-				msg, _ := message.Data.(OmciMessage)
-				onuDeviceEntry.handleOmciMibDownloadMessage(msg)
-			default:
-				logger.Warn("MibDownload Rx Msg", log.Fields{"Unknown message type received for device-id": onuDeviceEntry.deviceID,
-					"message.Type": message.Type})
-			}
+			logger.Warnw("MibDownload unknown TestMessage", log.Fields{"device-id": onuDeviceEntry.deviceID, "MessageVal": msg.TestMessageVal})
+		case OMCI:
+			msg, _ := message.Data.(OmciMessage)
+			onuDeviceEntry.handleOmciMibDownloadMessage(msg)
+		default:
+			logger.Warn("MibDownload Rx Msg", log.Fields{"Unknown message type received for device-id": onuDeviceEntry.deviceID,
+				"message.Type": message.Type})
 		}
+
 	}
 	logger.Infow("End MibDownload Msg processing", log.Fields{"for device-id": onuDeviceEntry.deviceID})
 }
@@ -179,7 +179,7 @@
 				switch onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetName() {
 				case "GalEthernetProfile":
 					{ // let the FSM proceed ...
-						onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRxGalResp)
+						_ = onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRxGalResp)
 					}
 				case "MacBridgeServiceProfile",
 					"MacBridgePortConfigurationData",
@@ -221,7 +221,7 @@
 				switch onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetName() {
 				case "Onu2G":
 					{ // let the FSM proceed ...
-						onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRxOnu2gResp)
+						_ = onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRxOnu2gResp)
 					}
 					//so far that was the only MibDownlad Set Element ...
 				}
@@ -248,7 +248,7 @@
 		err := onuDeviceEntry.waitforOmciResponse(meInstance)
 		if err != nil {
 			logger.Error("InitialBridgeSetup failed at MBSP, aborting MIB Download!")
-			onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvReset)
+			_ = onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvReset)
 			return
 		}
 
@@ -260,7 +260,7 @@
 		err = onuDeviceEntry.waitforOmciResponse(meInstance)
 		if err != nil {
 			logger.Error("InitialBridgeSetup failed at MBPCD, aborting MIB Download!")
-			onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvReset)
+			_ = onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvReset)
 			return
 		}
 
@@ -272,32 +272,31 @@
 		err = onuDeviceEntry.waitforOmciResponse(meInstance)
 		if err != nil {
 			logger.Error("InitialBridgeSetup failed at EVTOCD, aborting MIB Download!")
-			onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvReset)
+			_ = onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvReset)
 			return
 		}
 	}
 	// if Config has been done for all UNI related instances let the FSM proceed
 	// while we did not check here, if there is some port at all - !?
 	logger.Infow("IntialBridgeSetup finished", log.Fields{"device-id": onuDeviceEntry.deviceID})
-	onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRxBridgeResp)
-	return
+	_ = onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRxBridgeResp)
 }
 
 func (onuDeviceEntry *OnuDeviceEntry) waitforOmciResponse(apMeInstance *me.ManagedEntity) error {
 	select {
-	// maybe be also some outside cancel (but no context modelled for the moment ...)
+	// maybe be also some outside cancel (but no context modeled for the moment ...)
 	// case <-ctx.Done():
 	// 		logger.Info("MibDownload-bridge-init message reception canceled", log.Fields{"for device-id": onuDeviceEntry.deviceID})
 	case <-time.After(30 * time.Second): //3s was detected to be to less in 8*8 bbsim test with debug Info/Debug
 		logger.Warnw("MibDownload-bridge-init timeout", log.Fields{"for device-id": onuDeviceEntry.deviceID})
-		return errors.New("MibDownloadBridgeInit timeout")
+		return errors.New("mibDownloadBridgeInit timeout")
 	case success := <-onuDeviceEntry.omciMessageReceived:
-		if success == true {
+		if success {
 			logger.Debug("MibDownload-bridge-init response received")
 			return nil
 		}
 		// should not happen so far
 		logger.Warnw("MibDownload-bridge-init response error", log.Fields{"for device-id": onuDeviceEntry.deviceID})
-		return errors.New("MibDownloadBridgeInit responseError")
+		return errors.New("mibDownloadBridgeInit responseError")
 	}
 }
diff --git a/internal/pkg/onuadaptercore/mib_sync.go b/internal/pkg/onuadaptercore/mib_sync.go
index e68338c..45aa197 100644
--- a/internal/pkg/onuadaptercore/mib_sync.go
+++ b/internal/pkg/onuadaptercore/mib_sync.go
@@ -74,7 +74,7 @@
 	logger.Debugw("MibSync FSM", log.Fields{"Start MibTemplate processing in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID})
 
 	logger.Debugw("MibSync FSM", log.Fields{"send mibReset in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID})
-	onuDeviceEntry.PDevOmciCC.sendMibReset(context.TODO(), ConstDefaultOmciTimeout, true)
+	_ = onuDeviceEntry.PDevOmciCC.sendMibReset(context.TODO(), ConstDefaultOmciTimeout, true)
 
 	//TODO: needs to handle timeouts
 }
@@ -82,16 +82,16 @@
 func (onuDeviceEntry *OnuDeviceEntry) enterGettingVendorAndSerialState(e *fsm.Event) {
 	logger.Debugw("MibSync FSM", log.Fields{"Start getting VendorId and SerialNumber in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID})
 	requestedAttributes := me.AttributeValueMap{"VendorId": "", "SerialNumber": 0}
-	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.OnuGClassID, OnugMeId, requestedAttributes, ConstDefaultOmciTimeout, true)
+	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.OnuGClassID, OnugMeID, requestedAttributes, ConstDefaultOmciTimeout, true)
 	//accept also nil as (error) return value for writing to LastTx
 	//  - this avoids misinterpretation of new received OMCI messages
 	onuDeviceEntry.PDevOmciCC.pLastTxMeInstance = meInstance
 }
 
-func (onuDeviceEntry *OnuDeviceEntry) enterGettingEquipmentIdState(e *fsm.Event) {
+func (onuDeviceEntry *OnuDeviceEntry) enterGettingEquipmentIDState(e *fsm.Event) {
 	logger.Debugw("MibSync FSM", log.Fields{"Start getting EquipmentId in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID})
 	requestedAttributes := me.AttributeValueMap{"EquipmentId": ""}
-	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.Onu2GClassID, Onu2gMeId, requestedAttributes, ConstDefaultOmciTimeout, true)
+	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.Onu2GClassID, Onu2gMeID, requestedAttributes, ConstDefaultOmciTimeout, true)
 	//accept also nil as (error) return value for writing to LastTx
 	//  - this avoids misinterpretation of new received OMCI messages
 	onuDeviceEntry.PDevOmciCC.pLastTxMeInstance = meInstance
@@ -100,7 +100,7 @@
 func (onuDeviceEntry *OnuDeviceEntry) enterGettingFirstSwVersionState(e *fsm.Event) {
 	logger.Debugw("MibSync FSM", log.Fields{"Start getting IsActive and Version of first SW-image in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID})
 	requestedAttributes := me.AttributeValueMap{"IsActive": 0, "Version": ""}
-	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.SoftwareImageClassID, FirstSwImageMeId, requestedAttributes, ConstDefaultOmciTimeout, true)
+	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.SoftwareImageClassID, FirstSwImageMeID, requestedAttributes, ConstDefaultOmciTimeout, true)
 	//accept also nil as (error) return value for writing to LastTx
 	//  - this avoids misinterpretation of new received OMCI messages
 	onuDeviceEntry.PDevOmciCC.pLastTxMeInstance = meInstance
@@ -109,7 +109,7 @@
 func (onuDeviceEntry *OnuDeviceEntry) enterGettingSecondSwVersionState(e *fsm.Event) {
 	logger.Debugw("MibSync FSM", log.Fields{"Start getting IsActive and Version of second SW-image in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID})
 	requestedAttributes := me.AttributeValueMap{"IsActive": 0, "Version": ""}
-	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.SoftwareImageClassID, SecondSwImageMeId, requestedAttributes, ConstDefaultOmciTimeout, true)
+	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.SoftwareImageClassID, SecondSwImageMeID, requestedAttributes, ConstDefaultOmciTimeout, true)
 	//accept also nil as (error) return value for writing to LastTx
 	//  - this avoids misinterpretation of new received OMCI messages
 	onuDeviceEntry.PDevOmciCC.pLastTxMeInstance = meInstance
@@ -118,7 +118,7 @@
 func (onuDeviceEntry *OnuDeviceEntry) enterGettingMacAddressState(e *fsm.Event) {
 	logger.Debugw("MibSync FSM", log.Fields{"Start getting MacAddress in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID})
 	requestedAttributes := me.AttributeValueMap{"MacAddress": ""}
-	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.IpHostConfigDataClassID, IpHostConfigDataMeId, requestedAttributes, ConstDefaultOmciTimeout, true)
+	meInstance := onuDeviceEntry.PDevOmciCC.sendGetMe(context.TODO(), me.IpHostConfigDataClassID, IPHostConfigDataMeID, requestedAttributes, ConstDefaultOmciTimeout, true)
 	//accept also nil as (error) return value for writing to LastTx
 	//  - this avoids misinterpretation of new received OMCI messages
 	onuDeviceEntry.PDevOmciCC.pLastTxMeInstance = meInstance
@@ -126,7 +126,7 @@
 
 func (onuDeviceEntry *OnuDeviceEntry) enterGettingMibTemplate(e *fsm.Event) {
 
-	for i := FirstSwImageMeId; i <= SecondSwImageMeId; i++ {
+	for i := FirstSwImageMeID; i <= SecondSwImageMeID; i++ {
 		if onuDeviceEntry.swImages[i].isActive > 0 {
 			onuDeviceEntry.activeSwVersion = onuDeviceEntry.swImages[i].version
 		}
@@ -154,23 +154,23 @@
 				for fistLevelKey, firstLevelValue := range fistLevelMap {
 					logger.Debugw("MibSync FSM - fistLevelKey", log.Fields{"fistLevelKey": fistLevelKey})
 					if uint16ValidNumber, err := strconv.ParseUint(fistLevelKey, 10, 16); err == nil {
-						meClassId := me.ClassID(uint16ValidNumber)
+						meClassID := me.ClassID(uint16ValidNumber)
 						logger.Debugw("MibSync FSM - fistLevelKey is a number in uint16-range", log.Fields{"uint16ValidNumber": uint16ValidNumber})
-						if IsSupportedClassId(meClassId) {
-							logger.Debugw("MibSync FSM - fistLevelKey is a supported classId", log.Fields{"meClassId": meClassId})
+						if IsSupportedClassId(meClassID) {
+							logger.Debugw("MibSync FSM - fistLevelKey is a supported classId", log.Fields{"meClassID": meClassID})
 							secondLevelMap := firstLevelValue.(map[string]interface{})
 							for secondLevelKey, secondLevelValue := range secondLevelMap {
 								logger.Debugw("MibSync FSM - secondLevelKey", log.Fields{"secondLevelKey": secondLevelKey})
 								if uint16ValidNumber, err := strconv.ParseUint(secondLevelKey, 10, 16); err == nil {
-									meEntityId := uint16(uint16ValidNumber)
-									logger.Debugw("MibSync FSM - secondLevelKey is a number and a valid EntityId", log.Fields{"meEntityId": meEntityId})
+									meEntityID := uint16(uint16ValidNumber)
+									logger.Debugw("MibSync FSM - secondLevelKey is a number and a valid EntityId", log.Fields{"meEntityID": meEntityID})
 									thirdLevelMap := secondLevelValue.(map[string]interface{})
 									for thirdLevelKey, thirdLevelValue := range thirdLevelMap {
-										if thirdLevelKey == "Attributes" {
-											logger.Debugw("MibSync FSM - thirdLevelKey refers to Attributes", log.Fields{"thirdLevelKey": thirdLevelKey})
+										if thirdLevelKey == "attributes" {
+											logger.Debugw("MibSync FSM - thirdLevelKey refers to attributes", log.Fields{"thirdLevelKey": thirdLevelKey})
 											attributesMap := thirdLevelValue.(map[string]interface{})
 											logger.Debugw("MibSync FSM - attributesMap", log.Fields{"attributesMap": attributesMap})
-											onuDeviceEntry.pOnuDB.PutMe(meClassId, meEntityId, attributesMap)
+											onuDeviceEntry.pOnuDB.PutMe(meClassID, meEntityID, attributesMap)
 											meStoredFromTemplate = true
 										}
 									}
@@ -206,7 +206,7 @@
 
 func (onuDeviceEntry *OnuDeviceEntry) enterUploadingState(e *fsm.Event) {
 	logger.Debugw("MibSync FSM", log.Fields{"send MibUpload in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID})
-	onuDeviceEntry.PDevOmciCC.sendMibUpload(context.TODO(), ConstDefaultOmciTimeout, true)
+	_ = onuDeviceEntry.PDevOmciCC.sendMibUpload(context.TODO(), ConstDefaultOmciTimeout, true)
 }
 
 func (onuDeviceEntry *OnuDeviceEntry) enterInSyncState(e *fsm.Event) {
@@ -238,32 +238,30 @@
 	logger.Debugw("MibSync Msg", log.Fields{"Start routine to process OMCI-messages for device-id": onuDeviceEntry.deviceID})
 loop:
 	for {
-		select {
 		// case <-ctx.Done():
 		// 	logger.Info("MibSync Msg", log.Fields{"Message handling canceled via context for device-id": onuDeviceEntry.deviceID})
 		// 	break loop
-		case message, ok := <-onuDeviceEntry.pMibUploadFsm.commChan:
-			if !ok {
-				logger.Info("MibSync Msg", log.Fields{"Message couldn't be read from channel for device-id": onuDeviceEntry.deviceID})
-				break loop
-			}
-			logger.Debugw("MibSync Msg", log.Fields{"Received message on ONU MibSyncChan for device-id": onuDeviceEntry.deviceID})
+		message, ok := <-onuDeviceEntry.pMibUploadFsm.commChan
+		if !ok {
+			logger.Info("MibSync Msg", log.Fields{"Message couldn't be read from channel for device-id": onuDeviceEntry.deviceID})
+			break loop
+		}
+		logger.Debugw("MibSync Msg", log.Fields{"Received message on ONU MibSyncChan for device-id": onuDeviceEntry.deviceID})
 
-			switch message.Type {
-			case TestMsg:
-				msg, _ := message.Data.(TestMessage)
-				onuDeviceEntry.handleTestMsg(msg)
-			case OMCI:
-				msg, _ := message.Data.(OmciMessage)
-				onuDeviceEntry.handleOmciMessage(msg)
-			default:
-				logger.Warn("MibSync Msg", log.Fields{"Unknown message type received for device-id": onuDeviceEntry.deviceID, "message.Type": message.Type})
-			}
+		switch message.Type {
+		case TestMsg:
+			msg, _ := message.Data.(TestMessage)
+			onuDeviceEntry.handleTestMsg(msg)
+		case OMCI:
+			msg, _ := message.Data.(OmciMessage)
+			onuDeviceEntry.handleOmciMessage(msg)
+		default:
+			logger.Warn("MibSync Msg", log.Fields{"Unknown message type received for device-id": onuDeviceEntry.deviceID, "message.Type": message.Type})
 		}
 	}
 	logger.Info("MibSync Msg", log.Fields{"Stopped handling of MibSyncChan for device-id": onuDeviceEntry.deviceID})
 	// TODO: only this action?
-	onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvStop)
+	_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvStop)
 }
 
 func (onuDeviceEntry *OnuDeviceEntry) handleTestMsg(msg TestMessage) {
@@ -272,16 +270,182 @@
 
 	switch msg.TestMessageVal {
 	case LoadMibTemplateFailed:
-		onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvUploadMib)
+		_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvUploadMib)
 		logger.Debugw("MibSync Msg", log.Fields{"state": string(onuDeviceEntry.pMibUploadFsm.pFsm.Current())})
 	case LoadMibTemplateOk:
-		onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvSuccess)
+		_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvSuccess)
 		logger.Debugw("MibSync Msg", log.Fields{"state": string(onuDeviceEntry.pMibUploadFsm.pFsm.Current())})
 	default:
 		logger.Warn("MibSync Msg", log.Fields{"Unknown message type received for device-id": onuDeviceEntry.deviceID, "msg.TestMessageVal": msg.TestMessageVal})
 	}
 }
 
+func (onuDeviceEntry *OnuDeviceEntry) handleOmciMibResetResponseMessage(msg OmciMessage) {
+	if onuDeviceEntry.pMibUploadFsm.pFsm.Is(ulStResettingMib) {
+		msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibResetResponse)
+		if msgLayer != nil {
+			msgObj, msgOk := msgLayer.(*omci.MibResetResponse)
+			if msgOk {
+				logger.Debugw("MibResetResponse Data", log.Fields{"data-fields": msgObj})
+				if msgObj.Result == me.Success {
+					// trigger retrieval of VendorId and SerialNumber
+					_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetVendorAndSerial)
+					return
+				}
+				logger.Errorw("Omci MibResetResponse Error", log.Fields{"Error": msgObj.Result})
+			} else {
+				logger.Error("Omci Msg layer could not be assigned")
+			}
+		} else {
+			logger.Error("Omci Msg layer could not be detected")
+		}
+	} else {
+		logger.Errorw("Omci MibResetResponse received", log.Fields{"in state ": onuDeviceEntry.pMibUploadFsm.pFsm.Current})
+	}
+	logger.Info("MibSync Msg", log.Fields{"Stopped handling of MibSyncChan for device-id": onuDeviceEntry.deviceID})
+	_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvStop)
+
+}
+
+func (onuDeviceEntry *OnuDeviceEntry) handleOmciMibUploadResponseMessage(msg OmciMessage) {
+	msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibUploadResponse)
+	if msgLayer == nil {
+		logger.Error("Omci Msg layer could not be detected")
+		return
+	}
+	msgObj, msgOk := msgLayer.(*omci.MibUploadResponse)
+	if !msgOk {
+		logger.Error("Omci Msg layer could not be assigned")
+		return
+	}
+	logger.Debugw("MibUploadResponse Data for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+	/* to be verified / reworked !!! */
+	onuDeviceEntry.PDevOmciCC.uploadNoOfCmds = msgObj.NumberOfCommands
+	if onuDeviceEntry.PDevOmciCC.uploadSequNo < onuDeviceEntry.PDevOmciCC.uploadNoOfCmds {
+		_ = onuDeviceEntry.PDevOmciCC.sendMibUploadNext(context.TODO(), ConstDefaultOmciTimeout, true)
+	} else {
+		logger.Error("Invalid number of commands received for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "uploadNoOfCmds": onuDeviceEntry.PDevOmciCC.uploadNoOfCmds})
+		//TODO right action?
+		_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvTimeout)
+	}
+}
+
+func (onuDeviceEntry *OnuDeviceEntry) handleOmciMibUploadNextResponseMessage(msg OmciMessage) {
+	msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibUploadNextResponse)
+	if msgLayer == nil {
+		logger.Error("Omci Msg layer could not be detected")
+		return
+	}
+	msgObj, msgOk := msgLayer.(*omci.MibUploadNextResponse)
+	if !msgOk {
+		logger.Error("Omci Msg layer could not be assigned")
+		return
+	}
+	if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
+		logger.Debugw("MibUploadNextResponse Data for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+	}
+	meClassID := msgObj.ReportedME.GetClassID()
+	meEntityID := msgObj.ReportedME.GetEntityID()
+	meAttributes := msgObj.ReportedME.GetAttributeValueMap()
+
+	onuDeviceEntry.pOnuDB.PutMe(meClassID, meEntityID, meAttributes)
+
+	if onuDeviceEntry.PDevOmciCC.uploadSequNo < onuDeviceEntry.PDevOmciCC.uploadNoOfCmds {
+		_ = onuDeviceEntry.PDevOmciCC.sendMibUploadNext(context.TODO(), ConstDefaultOmciTimeout, true)
+	} else {
+		onuDeviceEntry.pOnuDB.LogMeDb()
+		err := onuDeviceEntry.CreateAndPersistMibTemplate()
+		if err != nil {
+			logger.Errorw("MibSync - MibTemplate - Failed to create and persist the mib template", log.Fields{"error": err, "device-id": onuDeviceEntry.deviceID})
+		}
+
+		_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvSuccess)
+	}
+}
+
+func (onuDeviceEntry *OnuDeviceEntry) handleOmciGetResponseMessage(msg OmciMessage) {
+	msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeGetResponse)
+	if msgLayer != nil {
+		msgObj, msgOk := msgLayer.(*omci.GetResponse)
+		if msgOk {
+			logger.Debugw("MibSync FSM - GetResponse Data", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+			if msgObj.Result == me.Success {
+				entityID := onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetEntityID()
+				if msgObj.EntityClass == onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetClassID() && msgObj.EntityInstance == entityID {
+					meAttributes := msgObj.Attributes
+					meInstance := onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetName()
+					if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
+						logger.Debugf("MibSync FSM - GetResponse Data for %s", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj}, meInstance)
+					}
+					switch meInstance {
+					case "OnuG":
+						onuDeviceEntry.vendorID = fmt.Sprintf("%s", meAttributes["VendorId"])
+						snBytes, _ := me.InterfaceToOctets(meAttributes["SerialNumber"])
+						if OnugSerialNumberLen == len(snBytes) {
+							snVendorPart := fmt.Sprintf("%s", snBytes[:4])
+							snNumberPart := hex.EncodeToString(snBytes[4:])
+							onuDeviceEntry.serialNumber = snVendorPart + snNumberPart
+							logger.Debugw("MibSync FSM - GetResponse Data for Onu-G - VendorId/SerialNumber", log.Fields{"deviceId": onuDeviceEntry.deviceID,
+								"onuDeviceEntry.vendorID": onuDeviceEntry.vendorID, "onuDeviceEntry.serialNumber": onuDeviceEntry.serialNumber})
+						} else {
+							logger.Errorw("MibSync FSM - SerialNumber has wrong length", log.Fields{"deviceId": onuDeviceEntry.deviceID, "length": len(snBytes)})
+						}
+						// trigger retrieval of EquipmentId
+						_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetEquipmentID)
+						return
+					case "Onu2G":
+						onuDeviceEntry.equipmentID = fmt.Sprintf("%s", meAttributes["EquipmentId"])
+						logger.Debugw("MibSync FSM - GetResponse Data for Onu2-G - EquipmentId", log.Fields{"deviceId": onuDeviceEntry.deviceID,
+							"onuDeviceEntry.equipmentID": onuDeviceEntry.equipmentID})
+						// trigger retrieval of 1st SW-image info
+						_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetFirstSwVersion)
+						return
+					case "SoftwareImage":
+						if entityID <= SecondSwImageMeID {
+							onuDeviceEntry.swImages[entityID].version = fmt.Sprintf("%s", meAttributes["Version"])
+							onuDeviceEntry.swImages[entityID].isActive = meAttributes["IsActive"].(uint8)
+							logger.Debugw("MibSync FSM - GetResponse Data for SoftwareImage - Version/IsActive",
+								log.Fields{"deviceId": onuDeviceEntry.deviceID, "entityID": entityID,
+									"version": onuDeviceEntry.swImages[entityID].version, "isActive": onuDeviceEntry.swImages[entityID].isActive})
+						} else {
+							//TODO: error handling
+							logger.Errorw("MibSync FSM - Failed to GetResponse Data for SoftwareImage", log.Fields{"deviceId": onuDeviceEntry.deviceID})
+
+						}
+						if FirstSwImageMeID == entityID {
+							_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetSecondSwVersion)
+							return
+						} else if SecondSwImageMeID == entityID {
+							_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetMacAddress)
+							return
+						}
+					case "IpHostConfigData":
+						macBytes, _ := me.InterfaceToOctets(meAttributes["MacAddress"])
+						if OmciMacAddressLen == len(macBytes) {
+							onuDeviceEntry.macAddress = hex.EncodeToString(macBytes[:])
+							logger.Debugw("MibSync FSM - GetResponse Data for IpHostConfigData - MacAddress", log.Fields{"deviceId": onuDeviceEntry.deviceID,
+								"onuDeviceEntry.macAddress": onuDeviceEntry.macAddress})
+						} else {
+							logger.Errorw("MibSync FSM - MacAddress wrong length", log.Fields{"deviceId": onuDeviceEntry.deviceID, "length": len(macBytes)})
+						}
+						// trigger retrieval of mib template
+						_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetMibTemplate)
+						return
+					}
+				}
+			} else {
+				logger.Errorw("Omci GetResponse Error", log.Fields{"Error": msgObj.Result})
+			}
+		} else {
+			logger.Error("Omci Msg layer could not be assigned for GetResponse")
+		}
+	} else {
+		logger.Error("Omci Msg layer could not be detected for GetResponse")
+	}
+	logger.Info("MibSync Msg", log.Fields{"Stopped handling of MibSyncChan for device-id": onuDeviceEntry.deviceID})
+	_ = onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvStop)
+}
+
 func (onuDeviceEntry *OnuDeviceEntry) handleOmciMessage(msg OmciMessage) {
 	if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
 		logger.Debugw("MibSync Msg", log.Fields{"OmciMessage received for device-id": onuDeviceEntry.deviceID,
@@ -290,177 +454,23 @@
 	//further analysis could be done here based on msg.OmciMsg.Payload, e.g. verification of error code ...
 	switch msg.OmciMsg.MessageType {
 	case omci.MibResetResponseType:
-		if onuDeviceEntry.pMibUploadFsm.pFsm.Is(ulStResettingMib) {
-			msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibResetResponse)
-			if msgLayer != nil {
-				msgObj, msgOk := msgLayer.(*omci.MibResetResponse)
-				if msgOk {
-					logger.Debugw("MibResetResponse Data", log.Fields{"data-fields": msgObj})
-					if msgObj.Result == me.Success {
-						// trigger retrieval of VendorId and SerialNumber
-						onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetVendorAndSerial)
-						return
-					} else {
-						logger.Errorw("Omci MibResetResponse Error", log.Fields{"Error": msgObj.Result})
-					}
-				} else {
-					logger.Error("Omci Msg layer could not be assigned")
-				}
-			} else {
-				logger.Error("Omci Msg layer could not be detected")
-			}
-		} else {
-			logger.Errorw("Omci MibResetResponse received", log.Fields{"in state ": onuDeviceEntry.pMibUploadFsm.pFsm.Current})
-		}
-		logger.Info("MibSync Msg", log.Fields{"Stopped handling of MibSyncChan for device-id": onuDeviceEntry.deviceID})
-		onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvStop)
+		onuDeviceEntry.handleOmciMibResetResponseMessage(msg)
 
 	case omci.MibUploadResponseType:
-		msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibUploadResponse)
-		if msgLayer == nil {
-			logger.Error("Omci Msg layer could not be detected")
-			return
-		}
-		msgObj, msgOk := msgLayer.(*omci.MibUploadResponse)
-		if !msgOk {
-			logger.Error("Omci Msg layer could not be assigned")
-			return
-		}
-		logger.Debugw("MibUploadResponse Data for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
-		/* to be verified / reworked !!! */
-		onuDeviceEntry.PDevOmciCC.uploadNoOfCmds = msgObj.NumberOfCommands
-		if onuDeviceEntry.PDevOmciCC.uploadSequNo < onuDeviceEntry.PDevOmciCC.uploadNoOfCmds {
-			onuDeviceEntry.PDevOmciCC.sendMibUploadNext(context.TODO(), ConstDefaultOmciTimeout, true)
-		} else {
-			logger.Error("Invalid number of commands received for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "uploadNoOfCmds": onuDeviceEntry.PDevOmciCC.uploadNoOfCmds})
-			//TODO right action?
-			onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvTimeout)
-		}
+		onuDeviceEntry.handleOmciMibUploadResponseMessage(msg)
+
 	case omci.MibUploadNextResponseType:
-		msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibUploadNextResponse)
-		if msgLayer == nil {
-			logger.Error("Omci Msg layer could not be detected")
-			return
-		}
-		msgObj, msgOk := msgLayer.(*omci.MibUploadNextResponse)
-		if !msgOk {
-			logger.Error("Omci Msg layer could not be assigned")
-			return
-		}
-		if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
-			logger.Debugw("MibUploadNextResponse Data for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
-		}
-		meClassId := msgObj.ReportedME.GetClassID()
-		meEntityId := msgObj.ReportedME.GetEntityID()
-		meAttributes := msgObj.ReportedME.GetAttributeValueMap()
+		onuDeviceEntry.handleOmciMibUploadNextResponseMessage(msg)
 
-		onuDeviceEntry.pOnuDB.PutMe(meClassId, meEntityId, meAttributes)
-
-		if onuDeviceEntry.PDevOmciCC.uploadSequNo < onuDeviceEntry.PDevOmciCC.uploadNoOfCmds {
-			onuDeviceEntry.PDevOmciCC.sendMibUploadNext(context.TODO(), ConstDefaultOmciTimeout, true)
-		} else {
-			onuDeviceEntry.pOnuDB.LogMeDb()
-			err := onuDeviceEntry.CreateAndPersistMibTemplate()
-			if err != nil {
-				logger.Errorw("MibSync - MibTemplate - Failed to create and persist the mib template", log.Fields{"error": err, "device-id": onuDeviceEntry.deviceID})
-			}
-
-			onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvSuccess)
-		}
 	case omci.GetResponseType:
-		msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeGetResponse)
-		if msgLayer != nil {
-			msgObj, msgOk := msgLayer.(*omci.GetResponse)
-			if msgOk {
-				logger.Debugw("MibSync FSM - GetResponse Data", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
-				if msgObj.Result == me.Success {
-					entityId := onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetEntityID()
-					if msgObj.EntityClass == onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetClassID() && msgObj.EntityInstance == entityId {
-						meAttributes := msgObj.Attributes
-						switch onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetName() {
-						case "OnuG":
-							if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
-								logger.Debugw("MibSync FSM - GetResponse Data for Onu-G", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
-							}
-							onuDeviceEntry.vendorID = fmt.Sprintf("%s", meAttributes["VendorId"])
-							snBytes, _ := me.InterfaceToOctets(meAttributes["SerialNumber"])
-							if OnugSerialNumberLen == len(snBytes) {
-								snVendorPart := fmt.Sprintf("%s", snBytes[:4])
-								snNumberPart := hex.EncodeToString(snBytes[4:])
-								onuDeviceEntry.serialNumber = snVendorPart + snNumberPart
-								logger.Debugw("MibSync FSM - GetResponse Data for Onu-G - VendorId/SerialNumber", log.Fields{"deviceId": onuDeviceEntry.deviceID,
-									"onuDeviceEntry.vendorID": onuDeviceEntry.vendorID, "onuDeviceEntry.serialNumber": onuDeviceEntry.serialNumber})
-							} else {
-								logger.Errorw("MibSync FSM - SerialNumber has wrong length", log.Fields{"deviceId": onuDeviceEntry.deviceID, "length": len(snBytes)})
-							}
-							// trigger retrieval of EquipmentId
-							onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetEquipmentId)
-							return
-						case "Onu2G":
-							if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
-								logger.Debugw("MibSync FSM - GetResponse Data for Onu2-G", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
-							}
-							onuDeviceEntry.equipmentID = fmt.Sprintf("%s", meAttributes["EquipmentId"])
-							logger.Debugw("MibSync FSM - GetResponse Data for Onu2-G - EquipmentId", log.Fields{"deviceId": onuDeviceEntry.deviceID,
-								"onuDeviceEntry.equipmentID": onuDeviceEntry.equipmentID})
-							// trigger retrieval of 1st SW-image info
-							onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetFirstSwVersion)
-							return
-						case "SoftwareImage":
-							if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
-								logger.Debugw("MibSync FSM - GetResponse Data for SoftwareImage", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
-							}
-							if entityId <= SecondSwImageMeId {
-								onuDeviceEntry.swImages[entityId].version = fmt.Sprintf("%s", meAttributes["Version"])
-								onuDeviceEntry.swImages[entityId].isActive = meAttributes["IsActive"].(uint8)
-								logger.Debugw("MibSync FSM - GetResponse Data for SoftwareImage - Version/IsActive",
-									log.Fields{"deviceId": onuDeviceEntry.deviceID, "entityId": entityId,
-										"version": onuDeviceEntry.swImages[entityId].version, "isActive": onuDeviceEntry.swImages[entityId].isActive})
-							} else {
-								//TODO: error handling
-							}
-							if FirstSwImageMeId == entityId {
-								onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetSecondSwVersion)
-								return
-							} else if SecondSwImageMeId == entityId {
-								onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetMacAddress)
-								return
-							}
-						case "IpHostConfigData":
-							///
-							if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
-								logger.Debugw("MibSync FSM - GetResponse Data for IpHostConfigData", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
-							}
-							macBytes, _ := me.InterfaceToOctets(meAttributes["MacAddress"])
-							if OmciMacAddressLen == len(macBytes) {
-								onuDeviceEntry.macAddress = hex.EncodeToString(macBytes[:])
-								logger.Debugw("MibSync FSM - GetResponse Data for IpHostConfigData - MacAddress", log.Fields{"deviceId": onuDeviceEntry.deviceID,
-									"onuDeviceEntry.macAddress": onuDeviceEntry.macAddress})
-							} else {
-								logger.Errorw("MibSync FSM - MacAddress wrong length", log.Fields{"deviceId": onuDeviceEntry.deviceID, "length": len(macBytes)})
-							}
-							// trigger retrieval of mib template
-							onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetMibTemplate)
-							return
-						}
-					}
-				} else {
-					logger.Errorw("Omci GetResponse Error", log.Fields{"Error": msgObj.Result})
-				}
-			} else {
-				logger.Error("Omci Msg layer could not be assigned for GetResponse")
-			}
-		} else {
-			logger.Error("Omci Msg layer could not be detected for GetResponse")
-		}
-		logger.Info("MibSync Msg", log.Fields{"Stopped handling of MibSyncChan for device-id": onuDeviceEntry.deviceID})
-		onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvStop)
+		onuDeviceEntry.handleOmciGetResponseMessage(msg)
+
 	}
 }
 
-func IsSupportedClassId(meClassId me.ClassID) bool {
+func IsSupportedClassId(meClassID me.ClassID) bool {
 	for _, v := range supportedClassIds {
-		if v == meClassId {
+		if v == meClassID {
 			return true
 		}
 	}
diff --git a/internal/pkg/onuadaptercore/omci_ani_config.go b/internal/pkg/onuadaptercore/omci_ani_config.go
index b152818..1d5e5d4 100644
--- a/internal/pkg/onuadaptercore/omci_ani_config.go
+++ b/internal/pkg/onuadaptercore/omci_ani_config.go
@@ -20,6 +20,7 @@
 import (
 	"context"
 	"errors"
+	"fmt"
 	"strconv"
 	"time"
 
@@ -82,7 +83,7 @@
 	pOnuDB                   *OnuDeviceDB
 	techProfileID            uint16
 	requestEvent             OnuDeviceEvent
-	omciMIdsResponseReceived chan bool //seperate channel needed for checking multiInstance OMCI message responses
+	omciMIdsResponseReceived chan bool //separate channel needed for checking multiInstance OMCI message responses
 	pAdaptFsm                *AdapterFsm
 	aniConfigCompleted       bool
 	chSuccess                chan<- uint8
@@ -212,7 +213,7 @@
 				oFsm.mapperSP0ID = ieeeMapperServiceProfileEID + uint16(oFsm.pOnuUniPort.macBpNo) + oFsm.techProfileID
 				oFsm.macBPCD0ID = macBridgePortAniEID + uint16(oFsm.pOnuUniPort.entityId) + oFsm.techProfileID
 
-				// For the time beeing: if there are multiple T-Conts on the ONU the first one from the entityID-ordered list is used
+				// For the time being: if there are multiple T-Conts on the ONU the first one from the entityID-ordered list is used
 				// TODO!: if more T-Conts have to be supported (tcontXID!), then use the first instances of the entity-ordered list
 				// or use the py code approach, which might be a bit more complicated, but also more secure, as it
 				// ensures that the selected T-Cont also has queues (which I would assume per definition from ONU, but who knows ...)
@@ -230,7 +231,7 @@
 				loGemPortAttribs := ponAniGemPortAttribs{}
 				//for all TechProfile set GemIndices
 				for _, gemEntry := range (*(oFsm.pUniTechProf.mapPonAniConfig[oFsm.pOnuUniPort.uniId]))[0].mapGemPortParams {
-					//collect all GemConfigData in a seperate Fsm related slice (needed also to avoid mix-up with unsorted mapPonAniConfig)
+					//collect all GemConfigData in a separate Fsm related slice (needed also to avoid mix-up with unsorted mapPonAniConfig)
 
 					if queueInstKeys := oFsm.pOnuDB.GetSortedInstKeys(me.PriorityQueueClassID); len(queueInstKeys) > 0 {
 
@@ -249,18 +250,18 @@
 
 						usQueueFound := false
 						dsQueueFound := false
-						for _, mgmtEntityId := range queueInstKeys {
-							if meAttributes := oFsm.pOnuDB.GetMe(me.PriorityQueueClassID, mgmtEntityId); meAttributes != nil {
+						for _, mgmtEntityID := range queueInstKeys {
+							if meAttributes := oFsm.pOnuDB.GetMe(me.PriorityQueueClassID, mgmtEntityID); meAttributes != nil {
 								returnVal := meAttributes["RelatedPort"]
 								if returnVal != nil {
 									if relatedPort, err := oFsm.pOnuDB.GetUint32Attrib(returnVal); err == nil {
 										if relatedPort == usQrelPortMask {
-											loGemPortAttribs.upQueueID = mgmtEntityId
+											loGemPortAttribs.upQueueID = mgmtEntityID
 											logger.Debugw("UpQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
 												"upQueueID": strconv.FormatInt(int64(loGemPortAttribs.upQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
 											usQueueFound = true
-										} else if (relatedPort&0xFFFFFF) == dsQrelPortMask && mgmtEntityId < 0x8000 {
-											loGemPortAttribs.downQueueID = mgmtEntityId
+										} else if (relatedPort&0xFFFFFF) == dsQrelPortMask && mgmtEntityID < 0x8000 {
+											loGemPortAttribs.downQueueID = mgmtEntityID
 											logger.Debugw("DownQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
 												"downQueueID": strconv.FormatInt(int64(loGemPortAttribs.downQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
 											dsQueueFound = true
@@ -276,7 +277,7 @@
 								}
 							} else {
 								logger.Warnw("No attributes available in DB:", log.Fields{"meClassID": me.PriorityQueueClassID,
-									"mgmtEntityId": mgmtEntityId, "device-id": oFsm.pAdaptFsm.deviceID})
+									"mgmtEntityID": mgmtEntityID, "device-id": oFsm.pAdaptFsm.deviceID})
 							}
 						}
 					} else {
@@ -297,7 +298,7 @@
 
 					oFsm.gemPortAttribsSlice = append(oFsm.gemPortAttribsSlice, loGemPortAttribs)
 				}
-				a_pAFsm.pFsm.Event(aniEvStartConfig)
+				_ = a_pAFsm.pFsm.Event(aniEvStartConfig)
 			}
 		}(pConfigAniStateAFsm)
 	}
@@ -383,7 +384,7 @@
 
 	meParams := me.ParamData{
 		EntityID:   oFsm.mapperSP0ID,
-		Attributes: make(me.AttributeValueMap, 0),
+		Attributes: make(me.AttributeValueMap),
 	}
 
 	//assign the GemPorts according to the configured Prio
@@ -410,55 +411,18 @@
 		}
 	}
 	var foundIwPtr bool = false
-	if loPrioGemPortArray[0] != 0 {
-		foundIwPtr = true
-		logger.Debugw("UniPonAniConfigFsm Set::1pMapper", log.Fields{
-			"IwPtr for Prio0": strconv.FormatInt(int64(loPrioGemPortArray[0]), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-		meParams.Attributes["InterworkTpPointerForPBitPriority0"] = loPrioGemPortArray[0]
+	for index, value := range loPrioGemPortArray {
+		if value != 0 {
+			foundIwPtr = true
+			meAttribute := fmt.Sprintf("InterworkTpPointerForPBitPriority%d", index)
+			logger.Debugf("UniPonAniConfigFsm Set::1pMapper", log.Fields{
+				"IwPtr for Prio%d": strconv.FormatInt(int64(value), 16), "device-id": oFsm.pAdaptFsm.deviceID}, index)
+			meParams.Attributes[meAttribute] = value
+
+		}
 	}
-	if loPrioGemPortArray[1] != 0 {
-		foundIwPtr = true
-		logger.Debugw("UniPonAniConfigFsm Set::1pMapper", log.Fields{
-			"IwPtr for Prio1": strconv.FormatInt(int64(loPrioGemPortArray[1]), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-		meParams.Attributes["InterworkTpPointerForPBitPriority1"] = loPrioGemPortArray[1]
-	}
-	if loPrioGemPortArray[2] != 0 {
-		foundIwPtr = true
-		logger.Debugw("UniPonAniConfigFsm Set::1pMapper", log.Fields{
-			"IwPtr for Prio2": strconv.FormatInt(int64(loPrioGemPortArray[2]), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-		meParams.Attributes["InterworkTpPointerForPBitPriority2"] = loPrioGemPortArray[2]
-	}
-	if loPrioGemPortArray[3] != 0 {
-		foundIwPtr = true
-		logger.Debugw("UniPonAniConfigFsm Set::1pMapper", log.Fields{
-			"IwPtr for Prio3": strconv.FormatInt(int64(loPrioGemPortArray[3]), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-		meParams.Attributes["InterworkTpPointerForPBitPriority3"] = loPrioGemPortArray[3]
-	}
-	if loPrioGemPortArray[4] != 0 {
-		foundIwPtr = true
-		logger.Debugw("UniPonAniConfigFsm Set::1pMapper", log.Fields{
-			"IwPtr for Prio4": strconv.FormatInt(int64(loPrioGemPortArray[4]), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-		meParams.Attributes["InterworkTpPointerForPBitPriority4"] = loPrioGemPortArray[4]
-	}
-	if loPrioGemPortArray[5] != 0 {
-		foundIwPtr = true
-		logger.Debugw("UniPonAniConfigFsm Set::1pMapper", log.Fields{
-			"IwPtr for Prio5": strconv.FormatInt(int64(loPrioGemPortArray[5]), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-		meParams.Attributes["InterworkTpPointerForPBitPriority5"] = loPrioGemPortArray[5]
-	}
-	if loPrioGemPortArray[6] != 0 {
-		foundIwPtr = true
-		logger.Debugw("UniPonAniConfigFsm Set::1pMapper", log.Fields{
-			"IwPtr for Prio6": strconv.FormatInt(int64(loPrioGemPortArray[6]), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-		meParams.Attributes["InterworkTpPointerForPBitPriority6"] = loPrioGemPortArray[6]
-	}
-	if loPrioGemPortArray[7] != 0 {
-		foundIwPtr = true
-		logger.Debugw("UniPonAniConfigFsm Set::1pMapper", log.Fields{
-			"IwPtr for Prio7": strconv.FormatInt(int64(loPrioGemPortArray[7]), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-		meParams.Attributes["InterworkTpPointerForPBitPriority7"] = loPrioGemPortArray[7]
-	}
-	if foundIwPtr == false {
+
+	if !foundIwPtr {
 		logger.Errorw("UniPonAniConfigFsm no GemIwPtr found for .1pMapper - abort", log.Fields{
 			"device-id": oFsm.pAdaptFsm.deviceID})
 		//let's reset the state machine in order to release all resources now
@@ -467,7 +431,7 @@
 			// obviously calling some FSM event here directly does not work - so trying to decouple it ...
 			go func(a_pAFsm *AdapterFsm) {
 				if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-					a_pAFsm.pFsm.Event(aniEvReset)
+					_ = a_pAFsm.pFsm.Event(aniEvReset)
 				}
 			}(pConfigAniStateAFsm)
 		}
@@ -490,7 +454,7 @@
 		// obviously calling some FSM event here directly does not work - so trying to decouple it ...
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event(aniEvReset)
+				_ = a_pAFsm.pFsm.Event(aniEvReset)
 			}
 		}(pConfigAniStateAFsm)
 	}
@@ -513,7 +477,7 @@
 		//try to restart the FSM to 'disabled', decouple event transfer
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event(aniEvRestart)
+				_ = a_pAFsm.pFsm.Event(aniEvRestart)
 			}
 		}(pConfigAniStateAFsm)
 	}
@@ -548,37 +512,114 @@
 	logger.Debugw("Start UniPonAniConfigFsm Msg processing", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 loop:
 	for {
-		select {
 		// case <-ctx.Done():
 		// 	logger.Info("MibSync Msg", log.Fields{"Message handling canceled via context for device-id": oFsm.pAdaptFsm.deviceID})
 		// 	break loop
-		case message, ok := <-oFsm.pAdaptFsm.commChan:
-			if !ok {
-				logger.Info("UniPonAniConfigFsm Rx Msg - could not read from channel", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-				// but then we have to ensure a restart of the FSM as well - as exceptional procedure
-				oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
+		message, ok := <-oFsm.pAdaptFsm.commChan
+		if !ok {
+			logger.Info("UniPonAniConfigFsm Rx Msg - could not read from channel", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+			// but then we have to ensure a restart of the FSM as well - as exceptional procedure
+			_ = oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
+			break loop
+		}
+		logger.Debugw("UniPonAniConfigFsm Rx Msg", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+
+		switch message.Type {
+		case TestMsg:
+			msg, _ := message.Data.(TestMessage)
+			if msg.TestMessageVal == AbortMessageProcessing {
+				logger.Infow("UniPonAniConfigFsm abort ProcessMsg", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 				break loop
 			}
-			logger.Debugw("UniPonAniConfigFsm Rx Msg", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+			logger.Warnw("UniPonAniConfigFsm unknown TestMessage", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "MessageVal": msg.TestMessageVal})
+		case OMCI:
+			msg, _ := message.Data.(OmciMessage)
+			oFsm.handleOmciAniConfigMessage(msg)
+		default:
+			logger.Warn("UniPonAniConfigFsm Rx unknown message", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID,
+				"message.Type": message.Type})
+		}
 
-			switch message.Type {
-			case TestMsg:
-				msg, _ := message.Data.(TestMessage)
-				if msg.TestMessageVal == AbortMessageProcessing {
-					logger.Infow("UniPonAniConfigFsm abort ProcessMsg", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
-					break loop
-				}
-				logger.Warnw("UniPonAniConfigFsm unknown TestMessage", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "MessageVal": msg.TestMessageVal})
-			case OMCI:
-				msg, _ := message.Data.(OmciMessage)
-				oFsm.handleOmciAniConfigMessage(msg)
-			default:
-				logger.Warn("UniPonAniConfigFsm Rx unknown message", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID,
-					"message.Type": message.Type})
+	}
+	logger.Infow("End UniPonAniConfigFsm Msg processing", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+}
+
+func (oFsm *UniPonAniConfigFsm) handleOmciAniConfigCreateResponseMessage(msg OmciMessage) {
+	msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeCreateResponse)
+	if msgLayer == nil {
+		logger.Error("Omci Msg layer could not be detected for CreateResponse")
+		return
+	}
+	msgObj, msgOk := msgLayer.(*omci.CreateResponse)
+	if !msgOk {
+		logger.Error("Omci Msg layer could not be assigned for CreateResponse")
+		return
+	}
+	logger.Debugw("CreateResponse Data", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "data-fields": msgObj})
+	if msgObj.Result != me.Success {
+		logger.Errorw("Omci CreateResponse Error - later: drive FSM to abort state ?", log.Fields{"Error": msgObj.Result})
+		// possibly force FSM into abort or ignore some errors for some messages? store error for mgmt display?
+		return
+	}
+	if msgObj.EntityClass == oFsm.pOmciCC.pLastTxMeInstance.GetClassID() &&
+		msgObj.EntityInstance == oFsm.pOmciCC.pLastTxMeInstance.GetEntityID() {
+		// maybe we can use just the same eventName for different state transitions like "forward"
+		//   - might be checked, but so far I go for sure and have to inspect the concrete state events ...
+		switch oFsm.pOmciCC.pLastTxMeInstance.GetName() {
+		case "Ieee8021PMapperServiceProfile":
+			{ // let the FSM proceed ...
+				_ = oFsm.pAdaptFsm.pFsm.Event(aniEvRxDot1pmapCResp)
+			}
+		case "MacBridgePortConfigurationData":
+			{ // let the FSM proceed ...
+				_ = oFsm.pAdaptFsm.pFsm.Event(aniEvRxMbpcdResp)
+			}
+		case "GemPortNetworkCtp", "GemInterworkingTerminationPoint":
+			{ // let aniConfig Multi-Id processing proceed by stopping the wait function
+				oFsm.omciMIdsResponseReceived <- true
 			}
 		}
 	}
-	logger.Infow("End UniPonAniConfigFsm Msg processing", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+}
+
+func (oFsm *UniPonAniConfigFsm) handleOmciAniConfigSetResponseMessage(msg OmciMessage) {
+	msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeSetResponse)
+	if msgLayer == nil {
+		logger.Error("UniPonAniConfigFsm - Omci Msg layer could not be detected for SetResponse")
+		return
+	}
+	msgObj, msgOk := msgLayer.(*omci.SetResponse)
+	if !msgOk {
+		logger.Error("UniPonAniConfigFsm - Omci Msg layer could not be assigned for SetResponse")
+		return
+	}
+	logger.Debugw("UniPonAniConfigFsm SetResponse Data", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "data-fields": msgObj})
+	if msgObj.Result != me.Success {
+		logger.Errorw("UniPonAniConfigFsm - Omci SetResponse Error - later: drive FSM to abort state ?", log.Fields{"Error": msgObj.Result})
+		// possibly force FSM into abort or ignore some errors for some messages? store error for mgmt display?
+		return
+	}
+	if msgObj.EntityClass == oFsm.pOmciCC.pLastTxMeInstance.GetClassID() &&
+		msgObj.EntityInstance == oFsm.pOmciCC.pLastTxMeInstance.GetEntityID() {
+		//store the created ME into DB //TODO??? obviously the Python code does not store the config ...
+		// if, then something like:
+		//oFsm.pOnuDB.StoreMe(msgObj)
+
+		switch oFsm.pOmciCC.pLastTxMeInstance.GetName() {
+		case "TCont":
+			{ // let the FSM proceed ...
+				_ = oFsm.pAdaptFsm.pFsm.Event(aniEvRxTcontsResp)
+			}
+		case "PriorityQueue":
+			{ // let the PrioQueue init proceed by stopping the wait function
+				oFsm.omciMIdsResponseReceived <- true
+			}
+		case "Ieee8021PMapperServiceProfile":
+			{ // let the FSM proceed ...
+				_ = oFsm.pAdaptFsm.pFsm.Event(aniEvRxDot1pmapSResp)
+			}
+		}
+	}
 }
 
 func (oFsm *UniPonAniConfigFsm) handleOmciAniConfigMessage(msg OmciMessage) {
@@ -588,81 +629,13 @@
 	switch msg.OmciMsg.MessageType {
 	case omci.CreateResponseType:
 		{
-			msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeCreateResponse)
-			if msgLayer == nil {
-				logger.Error("Omci Msg layer could not be detected for CreateResponse")
-				return
-			}
-			msgObj, msgOk := msgLayer.(*omci.CreateResponse)
-			if !msgOk {
-				logger.Error("Omci Msg layer could not be assigned for CreateResponse")
-				return
-			}
-			logger.Debugw("CreateResponse Data", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "data-fields": msgObj})
-			if msgObj.Result != me.Success {
-				logger.Errorw("Omci CreateResponse Error - later: drive FSM to abort state ?", log.Fields{"Error": msgObj.Result})
-				// possibly force FSM into abort or ignore some errors for some messages? store error for mgmt display?
-				return
-			}
-			if msgObj.EntityClass == oFsm.pOmciCC.pLastTxMeInstance.GetClassID() &&
-				msgObj.EntityInstance == oFsm.pOmciCC.pLastTxMeInstance.GetEntityID() {
-				// maybe we can use just the same eventName for different state transitions like "forward"
-				//   - might be checked, but so far I go for sure and have to inspect the concrete state events ...
-				switch oFsm.pOmciCC.pLastTxMeInstance.GetName() {
-				case "Ieee8021PMapperServiceProfile":
-					{ // let the FSM proceed ...
-						oFsm.pAdaptFsm.pFsm.Event(aniEvRxDot1pmapCResp)
-					}
-				case "MacBridgePortConfigurationData":
-					{ // let the FSM proceed ...
-						oFsm.pAdaptFsm.pFsm.Event(aniEvRxMbpcdResp)
-					}
-				case "GemPortNetworkCtp", "GemInterworkingTerminationPoint":
-					{ // let aniConfig Multi-Id processing proceed by stopping the wait function
-						oFsm.omciMIdsResponseReceived <- true
-					}
-				}
-			}
+			oFsm.handleOmciAniConfigCreateResponseMessage(msg)
+
 		} //CreateResponseType
 	case omci.SetResponseType:
 		{
-			msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeSetResponse)
-			if msgLayer == nil {
-				logger.Error("UniPonAniConfigFsm - Omci Msg layer could not be detected for SetResponse")
-				return
-			}
-			msgObj, msgOk := msgLayer.(*omci.SetResponse)
-			if !msgOk {
-				logger.Error("UniPonAniConfigFsm - Omci Msg layer could not be assigned for SetResponse")
-				return
-			}
-			logger.Debugw("UniPonAniConfigFsm SetResponse Data", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "data-fields": msgObj})
-			if msgObj.Result != me.Success {
-				logger.Errorw("UniPonAniConfigFsm - Omci SetResponse Error - later: drive FSM to abort state ?", log.Fields{"Error": msgObj.Result})
-				// possibly force FSM into abort or ignore some errors for some messages? store error for mgmt display?
-				return
-			}
-			if msgObj.EntityClass == oFsm.pOmciCC.pLastTxMeInstance.GetClassID() &&
-				msgObj.EntityInstance == oFsm.pOmciCC.pLastTxMeInstance.GetEntityID() {
-				//store the created ME into DB //TODO??? obviously the Python code does not store the config ...
-				// if, then something like:
-				//oFsm.pOnuDB.StoreMe(msgObj)
+			oFsm.handleOmciAniConfigSetResponseMessage(msg)
 
-				switch oFsm.pOmciCC.pLastTxMeInstance.GetName() {
-				case "TCont":
-					{ // let the FSM proceed ...
-						oFsm.pAdaptFsm.pFsm.Event(aniEvRxTcontsResp)
-					}
-				case "PriorityQueue":
-					{ // let the PrioQueue init proceed by stopping the wait function
-						oFsm.omciMIdsResponseReceived <- true
-					}
-				case "Ieee8021PMapperServiceProfile":
-					{ // let the FSM proceed ...
-						oFsm.pAdaptFsm.pFsm.Event(aniEvRxDot1pmapSResp)
-					}
-				}
-			}
 		} //SetResponseType
 	default:
 		{
@@ -702,15 +675,14 @@
 		if err != nil {
 			logger.Errorw("GemNWCtp create failed, aborting AniConfig FSM!",
 				log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "GemIndex": gemIndex})
-			oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
+			_ = oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 			return
 		}
 	} //for all GemPorts of this T-Cont
 
 	// if Config has been done for all GemPort instances let the FSM proceed
 	logger.Debugw("GemNWCtp create loop finished", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-	oFsm.pAdaptFsm.pFsm.Event(aniEvRxGemntcpsResp)
-	return
+	_ = oFsm.pAdaptFsm.pFsm.Event(aniEvRxGemntcpsResp)
 }
 
 func (oFsm *UniPonAniConfigFsm) performCreatingGemIWs() {
@@ -741,15 +713,14 @@
 		if err != nil {
 			logger.Errorw("GemIwTp create failed, aborting AniConfig FSM!",
 				log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "GemIndex": gemIndex})
-			oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
+			_ = oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 			return
 		}
 	} //for all GemPort's of this T-Cont
 
 	// if Config has been done for all GemPort instances let the FSM proceed
 	logger.Debugw("GemIwTp create loop finished", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-	oFsm.pAdaptFsm.pFsm.Event(aniEvRxGemiwsResp)
-	return
+	_ = oFsm.pAdaptFsm.pFsm.Event(aniEvRxGemiwsResp)
 }
 
 func (oFsm *UniPonAniConfigFsm) performSettingPQs() {
@@ -758,7 +729,7 @@
 	loQueueMap := ordered_map.NewOrderedMap()
 	for _, gemPortAttribs := range oFsm.gemPortAttribsSlice {
 		if gemPortAttribs.qosPolicy == "WRR" {
-			if _, ok := loQueueMap.Get(gemPortAttribs.upQueueID); ok == false {
+			if _, ok := loQueueMap.Get(gemPortAttribs.upQueueID); !ok {
 				//key does not yet exist
 				loQueueMap.Set(gemPortAttribs.upQueueID, uint16(gemPortAttribs.weight))
 			}
@@ -782,7 +753,7 @@
 		queueIndex := (kv.Key).(uint16)
 		meParams := me.ParamData{
 			EntityID:   queueIndex,
-			Attributes: make(me.AttributeValueMap, 0),
+			Attributes: make(me.AttributeValueMap),
 		}
 		if (kv.Value).(uint16) == cu16StrictPrioWeight {
 			//StrictPrio indication
@@ -810,7 +781,7 @@
 		if err != nil {
 			logger.Errorw("PrioQueue set failed, aborting AniConfig FSM!",
 				log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "QueueId": strconv.FormatInt(int64(queueIndex), 16)})
-			oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
+			_ = oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 			return
 		}
 
@@ -823,25 +794,24 @@
 
 	// if Config has been done for all PrioQueue instances let the FSM proceed
 	logger.Debugw("PrioQueue set loop finished", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-	oFsm.pAdaptFsm.pFsm.Event(aniEvRxPrioqsResp)
-	return
+	_ = oFsm.pAdaptFsm.pFsm.Event(aniEvRxPrioqsResp)
 }
 
 func (oFsm *UniPonAniConfigFsm) waitforOmciResponse() error {
 	select {
-	// maybe be also some outside cancel (but no context modelled for the moment ...)
+	// maybe be also some outside cancel (but no context modeled for the moment ...)
 	// case <-ctx.Done():
 	// 		logger.Infow("LockState-bridge-init message reception canceled", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 	case <-time.After(30 * time.Second): //3s was detected to be to less in 8*8 bbsim test with debug Info/Debug
 		logger.Warnw("UniPonAniConfigFsm multi entity timeout", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
-		return errors.New("UniPonAniConfigFsm multi entity timeout")
+		return errors.New("uniPonAniConfigFsm multi entity timeout")
 	case success := <-oFsm.omciMIdsResponseReceived:
-		if success == true {
+		if success {
 			logger.Debug("UniPonAniConfigFsm multi entity response received")
 			return nil
 		}
 		// should not happen so far
 		logger.Warnw("UniPonAniConfigFsm multi entity response error", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
-		return errors.New("UniPonAniConfigFsm multi entity responseError")
+		return errors.New("uniPonAniConfigFsm multi entity responseError")
 	}
 }
diff --git a/internal/pkg/onuadaptercore/omci_cc.go b/internal/pkg/onuadaptercore/omci_cc.go
index 23fd506..1f70bd2 100644
--- a/internal/pkg/onuadaptercore/omci_cc.go
+++ b/internal/pkg/onuadaptercore/omci_cc.go
@@ -49,8 +49,9 @@
 const galEthernetEID = uint16(1)
 const maxGemPayloadSize = uint16(48)
 const connectivityModeValue = uint8(5)
-const defaultTPID = uint16(0x8100)
-const broadComDefaultVID = uint16(4091)
+
+//const defaultTPID = uint16(0x8100)
+//const broadComDefaultVID = uint16(4091)
 const macBridgeServiceProfileEID = uint16(0x201) // TODO: most all these need better definition or tuning
 const ieeeMapperServiceProfileEID = uint16(0x8001)
 const macBridgePortAniEID = uint16(0x2102)
@@ -108,17 +109,17 @@
 
 //NewOmciCC constructor returns a new instance of a OmciCC
 //mib_db (as well as not inluded alarm_db not really used in this code? VERIFY!!)
-func NewOmciCC(ctx context.Context, onu_device_entry *OnuDeviceEntry,
-	device_id string, device_handler *DeviceHandler,
-	core_proxy adapterif.CoreProxy, adapter_proxy adapterif.AdapterProxy) *OmciCC {
-	logger.Infow("init-omciCC", log.Fields{"device-id": device_id})
+func NewOmciCC(ctx context.Context, onuDeviceEntry *OnuDeviceEntry,
+	deviceID string, deviceHandler *DeviceHandler,
+	coreProxy adapterif.CoreProxy, adapterProxy adapterif.AdapterProxy) *OmciCC {
+	logger.Infow("init-omciCC", log.Fields{"device-id": deviceID})
 	var omciCC OmciCC
 	omciCC.enabled = false
-	omciCC.pOnuDeviceEntry = onu_device_entry
-	omciCC.deviceID = device_id
-	omciCC.pBaseDeviceHandler = device_handler
-	omciCC.coreProxy = core_proxy
-	omciCC.adapterProxy = adapter_proxy
+	omciCC.pOnuDeviceEntry = onuDeviceEntry
+	omciCC.deviceID = deviceID
+	omciCC.pBaseDeviceHandler = deviceHandler
+	omciCC.coreProxy = coreProxy
+	omciCC.adapterProxy = adapterProxy
 	omciCC.supportExtMsg = false
 	omciCC.txFrames = 0
 	omciCC.txOnuFrames = 0
@@ -183,7 +184,7 @@
 				}
 		    }
 	*/
-	return errors.New("ReceiveOnuMessage unimplemented")
+	return errors.New("receiveOnuMessage unimplemented")
 }
 
 // Rx handler for onu messages
@@ -201,8 +202,8 @@
 			logger.Debug("cc-corrected-omci-message: trailer len inserted")
 		}
 	} else {
-		logger.Errorw("received omci-message to small for OmciBaseFormat - abort", log.Fields{"Length": len(rxMsg)})
-		return errors.New("RxOmciMessage to small for BaseFormat")
+		logger.Errorw("received omci-message too small for OmciBaseFormat - abort", log.Fields{"Length": len(rxMsg)})
+		return errors.New("rxOmciMessage too small for BaseFormat")
 	}
 
 	packet := gopacket.NewPacket(rxMsg, omci.LayerTypeOMCI, gopacket.NoCopy)
@@ -227,27 +228,26 @@
 		logger.Debug("RxMsg is no Omci Response Message")
 		if omciMsg.TransactionID == 0 {
 			return oo.ReceiveOnuMessage(ctx, omciMsg)
-		} else {
-			logger.Errorw("Unexpected TransCorrId != 0  not accepted for autonomous messages",
-				log.Fields{"msgType": omciMsg.MessageType, "payload": hex.EncodeToString(omciMsg.Payload)})
-			return errors.New("Autonomous Omci Message with TranSCorrId != 0 not acccepted")
 		}
+		logger.Errorw("Unexpected TransCorrId != 0  not accepted for autonomous messages",
+			log.Fields{"msgType": omciMsg.MessageType, "payload": hex.EncodeToString(omciMsg.Payload)})
+		return errors.New("autonomous Omci Message with TranSCorrId != 0 not acccepted")
+
+	}
+	//logger.Debug("RxMsg is a Omci Response Message: try to schedule it to the requester")
+	oo.mutexRxSchedMap.Lock()
+	rxCallbackEntry, ok := oo.rxSchedulerMap[omciMsg.TransactionID]
+	if ok && rxCallbackEntry.cbFunction != nil {
+		//disadvantage of decoupling: error verification made difficult, but anyway the question is
+		// how to react on erroneous frame reception, maybe can simply be ignored
+		go rxCallbackEntry.cbFunction(omciMsg, &packet, rxCallbackEntry.cbRespChannel)
+		// having posted the response the request is regarded as 'done'
+		delete(oo.rxSchedulerMap, omciMsg.TransactionID)
+		oo.mutexRxSchedMap.Unlock()
 	} else {
-		//logger.Debug("RxMsg is a Omci Response Message: try to schedule it to the requester")
-		oo.mutexRxSchedMap.Lock()
-		rxCallbackEntry, ok := oo.rxSchedulerMap[omciMsg.TransactionID]
-		if ok && rxCallbackEntry.cbFunction != nil {
-			//disadvantage of decoupling: error verification made difficult, but anyway the question is
-			// how to react on erroneous frame reception, maybe can simply be ignored
-			go rxCallbackEntry.cbFunction(omciMsg, &packet, rxCallbackEntry.cbRespChannel)
-			// having posted the response the request is regarded as 'done'
-			delete(oo.rxSchedulerMap, omciMsg.TransactionID)
-			oo.mutexRxSchedMap.Unlock()
-		} else {
-			oo.mutexRxSchedMap.Unlock()
-			logger.Error("omci-message-response for not registered transCorrId")
-			return errors.New("could not find registered response handler tor transCorrId")
-		}
+		oo.mutexRxSchedMap.Unlock()
+		logger.Error("omci-message-response for not registered transCorrId")
+		return errors.New("could not find registered response handler tor transCorrId")
 	}
 
 	return nil
@@ -355,7 +355,7 @@
 }
 
 func (oo *OmciCC) PublishRxResponseFrame(ctx context.Context, txFrame []byte, rxFrame []byte) error {
-	return errors.New("PublishRxResponseFrame unimplemented")
+	return errors.New("publishRxResponseFrame unimplemented")
 	/*
 		def _publish_rx_frame(self, tx_frame, rx_frame):
 	*/
@@ -486,7 +486,7 @@
 	if highPriority {
 		oo.mutexTid.Lock()
 		next = oo.hpTid
-		oo.hpTid += 1
+		oo.hpTid++
 		if oo.hpTid < 0x8000 {
 			oo.hpTid = 0x8000
 		}
@@ -494,7 +494,7 @@
 	} else {
 		oo.mutexHpTid.Lock()
 		next = oo.tid
-		oo.tid += 1
+		oo.tid++
 		if oo.tid >= 0x8000 {
 			oo.tid = 1
 		}
@@ -513,12 +513,12 @@
 	return serializeOmciLayer(omciLayer, request)
 }
 
-func serializeOmciLayer(a_omciLayer *omci.OMCI, a_request gopacket.SerializableLayer) ([]byte, error) {
+func serializeOmciLayer(aOmciLayer *omci.OMCI, aRequest gopacket.SerializableLayer) ([]byte, error) {
 	var options gopacket.SerializeOptions
 	options.FixLengths = true
 
 	buffer := gopacket.NewSerializeBuffer()
-	err := gopacket.SerializeLayers(buffer, options, a_omciLayer, a_request)
+	err := gopacket.SerializeLayers(buffer, options, aOmciLayer, aRequest)
 	if err != nil {
 		logger.Errorw("Could not create goPacket Omci serial buffer", log.Fields{"Err": err})
 		return nil, err
@@ -526,11 +526,13 @@
 	return buffer.Bytes(), nil
 }
 
+/*
 func hexEncode(omciPkt []byte) ([]byte, error) {
 	dst := make([]byte, hex.EncodedLen(len(omciPkt)))
 	hex.Encode(dst, omciPkt)
 	return dst, nil
 }
+*/
 
 //supply a response handler for omci response messages to be transferred to the requested FSM
 func (oo *OmciCC) receiveOmciResponse(omciMsg *omci.OMCI, packet *gp.Packet, respChan chan Message) error {
@@ -541,7 +543,7 @@
 	if oo.pOnuDeviceEntry == nil {
 		logger.Errorw("Abort receiving OMCI response, DeviceEntryPointer is nil", log.Fields{
 			"device-id": oo.deviceID})
-		return errors.New("DeviceEntryPointer is nil")
+		return errors.New("deviceEntryPointer is nil")
 	}
 
 	// no further test on SeqNo is done here, assignment from rxScheduler is trusted
@@ -609,7 +611,7 @@
 	err = oo.pOnuDeviceEntry.waitForRebootResponse(responseChannel)
 	if err != nil {
 		logger.Error("aborting ONU Reboot!")
-		oo.pOnuDeviceEntry.pMibDownloadFsm.pFsm.Event("reset")
+		_ = oo.pOnuDeviceEntry.pMibDownloadFsm.pFsm.Event("reset")
 		return err
 	}
 	return nil
@@ -756,9 +758,9 @@
 }
 
 func (oo *OmciCC) sendCreateMBServiceProfile(ctx context.Context,
-	a_pUniPort *OnuUniPort, timeout int, highPrio bool) *me.ManagedEntity {
+	aPUniPort *OnuUniPort, timeout int, highPrio bool) *me.ManagedEntity {
 	tid := oo.GetNextTid(highPrio)
-	instID := macBridgeServiceProfileEID + uint16(a_pUniPort.macBpNo)
+	instID := macBridgeServiceProfileEID + uint16(aPUniPort.macBpNo)
 	logger.Debugw("send MBSP-Create-msg:", log.Fields{"device-id": oo.deviceID,
 		"SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16)})
 
@@ -812,19 +814,19 @@
 }
 
 func (oo *OmciCC) sendCreateMBPConfigData(ctx context.Context,
-	a_pUniPort *OnuUniPort, timeout int, highPrio bool) *me.ManagedEntity {
+	aPUniPort *OnuUniPort, timeout int, highPrio bool) *me.ManagedEntity {
 	tid := oo.GetNextTid(highPrio)
-	instID := macBridgePortAniEID + a_pUniPort.entityId
+	instID := macBridgePortAniEID + aPUniPort.entityId
 	logger.Debugw("send MBPCD-Create-msg:", log.Fields{"device-id": oo.deviceID,
 		"SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16)})
 
 	meParams := me.ParamData{
 		EntityID: instID,
 		Attributes: me.AttributeValueMap{
-			"BridgeIdPointer": macBridgeServiceProfileEID + uint16(a_pUniPort.macBpNo),
-			"PortNum":         a_pUniPort.macBpNo,
-			"TpType":          uint8(a_pUniPort.portType),
-			"TpPointer":       a_pUniPort.entityId,
+			"BridgeIdPointer": macBridgeServiceProfileEID + uint16(aPUniPort.macBpNo),
+			"PortNum":         aPUniPort.macBpNo,
+			"TpType":          uint8(aPUniPort.portType),
+			"TpPointer":       aPUniPort.entityId,
 		},
 	}
 	meInstance, omciErr := me.NewMacBridgePortConfigurationData(meParams)
@@ -864,10 +866,10 @@
 }
 
 func (oo *OmciCC) sendCreateEVTOConfigData(ctx context.Context,
-	a_pUniPort *OnuUniPort, timeout int, highPrio bool) *me.ManagedEntity {
+	aPUniPort *OnuUniPort, timeout int, highPrio bool) *me.ManagedEntity {
 	tid := oo.GetNextTid(highPrio)
 	//same entityId is used as for MBSP (see there), but just arbitrary ...
-	instID := macBridgeServiceProfileEID + uint16(a_pUniPort.macBpNo)
+	instID := macBridgeServiceProfileEID + uint16(aPUniPort.macBpNo)
 	logger.Debugw("send EVTOCD-Create-msg:", log.Fields{"device-id": oo.deviceID,
 		"SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16)})
 
@@ -875,14 +877,14 @@
 	//   (setting TPID values for the create would probably anyway be ignored by the omci lib)
 	//    but perhaps we have to be aware of possible problems at get(Next) Request handling for EVTOOCD tables later ...
 	assType := uint8(2) // default AssociationType is PPTPEthUni
-	if a_pUniPort.portType == UniVEIP {
+	if aPUniPort.portType == UniVEIP {
 		assType = uint8(10) // for VEIP
 	}
 	meParams := me.ParamData{
 		EntityID: instID,
 		Attributes: me.AttributeValueMap{
 			"AssociationType":     assType,
-			"AssociatedMePointer": a_pUniPort.entityId,
+			"AssociatedMePointer": aPUniPort.entityId,
 		},
 	}
 	meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(meParams)
@@ -1068,15 +1070,15 @@
 	}
 	meInstance, omciErr := me.LoadManagedEntityDefinition(classID, meParams)
 	if omciErr.GetError() == nil {
-		meClassIdName := meInstance.GetName()
+		meClassIDName := meInstance.GetName()
 		omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.GetRequestType, omci.TransactionID(tid))
 		if err != nil {
-			logger.Errorf("Cannot encode instance for get-request", log.Fields{"meClassIdName": meClassIdName, "Err": err, "device-id": oo.deviceID})
+			logger.Errorf("Cannot encode instance for get-request", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID})
 			return nil
 		}
 		pkt, err := serializeOmciLayer(omciLayer, msgLayer)
 		if err != nil {
-			logger.Errorw("Cannot serialize get-request", log.Fields{"meClassIdName": meClassIdName, "Err": err, "device-id": oo.deviceID})
+			logger.Errorw("Cannot serialize get-request", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID})
 			return nil
 		}
 		omciRxCallbackPair := CallbackPair{
@@ -1085,10 +1087,10 @@
 		}
 		err = oo.Send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair)
 		if err != nil {
-			logger.Errorw("Cannot send get-request-msg", log.Fields{"meClassIdName": meClassIdName, "Err": err, "device-id": oo.deviceID})
+			logger.Errorw("Cannot send get-request-msg", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID})
 			return nil
 		}
-		logger.Debugw("send get-request-msg done", log.Fields{"meClassIdName": meClassIdName, "device-id": oo.deviceID})
+		logger.Debugw("send get-request-msg done", log.Fields{"meClassIDName": meClassIDName, "device-id": oo.deviceID})
 		return meInstance
 	}
 	logger.Errorw("Cannot generate meDefinition", log.Fields{"classID": classID, "Err": omciErr.GetError(), "device-id": oo.deviceID})
diff --git a/internal/pkg/onuadaptercore/omci_test_request.go b/internal/pkg/onuadaptercore/omci_test_request.go
index a1600fd..859dd9c 100644
--- a/internal/pkg/onuadaptercore/omci_test_request.go
+++ b/internal/pkg/onuadaptercore/omci_test_request.go
@@ -41,7 +41,7 @@
 	pDevOmciCC   *OmciCC
 	started      bool
 	result       bool
-	exclusive_cc bool
+	exclusiveCc  bool
 	allowFailure bool
 	txSeqNo      uint16
 	verifyDone   chan<- bool
@@ -49,26 +49,26 @@
 
 //NewOmciTestRequest returns a new instance of OmciTestRequest
 func NewOmciTestRequest(ctx context.Context,
-	device_id string, omci_cc *OmciCC,
-	exclusive bool, allow_failure bool) *OmciTestRequest {
+	deviceID string, omciCc *OmciCC,
+	exclusive bool, allowFailure bool) *OmciTestRequest {
 	logger.Debug("omciTestRequest-init")
 	var omciTestRequest OmciTestRequest
-	omciTestRequest.deviceID = device_id
-	omciTestRequest.pDevOmciCC = omci_cc
+	omciTestRequest.deviceID = deviceID
+	omciTestRequest.pDevOmciCC = omciCc
 	omciTestRequest.started = false
 	omciTestRequest.result = false
-	omciTestRequest.exclusive_cc = exclusive
-	omciTestRequest.allowFailure = allow_failure
+	omciTestRequest.exclusiveCc = exclusive
+	omciTestRequest.allowFailure = allowFailure
 
 	return &omciTestRequest
 }
 
 //
-func (oo *OmciTestRequest) PerformOmciTest(ctx context.Context, exec_Channel chan<- bool) {
+func (oo *OmciTestRequest) PerformOmciTest(ctx context.Context, execChannel chan<- bool) {
 	logger.Debug("omciTestRequest-start-test")
 
 	if oo.pDevOmciCC != nil {
-		oo.verifyDone = exec_Channel
+		oo.verifyDone = execChannel
 		// test functionality is limited to ONU-2G get request for the moment
 		// without yet checking the received response automatically here (might be improved ??)
 		tid := oo.pDevOmciCC.GetNextTid(false)
@@ -124,7 +124,7 @@
 		logger.Debugw("verify-omci-message-response error", log.Fields{"incorrect TransCorrId": omciMsg.TransactionID,
 			"expected": oo.txSeqNo})
 		oo.verifyDone <- false
-		return errors.New("Unexpected TransCorrId")
+		return errors.New("unexpected TransCorrId")
 	}
 	if omciMsg.MessageType == omci.GetResponseType {
 		logger.Debugw("verify-omci-message-response", log.Fields{"correct RespType": omciMsg.MessageType})
@@ -132,7 +132,7 @@
 		logger.Debugw("verify-omci-message-response error", log.Fields{"incorrect RespType": omciMsg.MessageType,
 			"expected": omci.GetResponseType})
 		oo.verifyDone <- false
-		return errors.New("Unexpected MessageType")
+		return errors.New("unexpected MessageType")
 	}
 
 	//TODO!!! further tests on the payload should be done here ...
diff --git a/internal/pkg/onuadaptercore/omci_vlan_config.go b/internal/pkg/onuadaptercore/omci_vlan_config.go
index f60cd93..1a08b40 100644
--- a/internal/pkg/onuadaptercore/omci_vlan_config.go
+++ b/internal/pkg/onuadaptercore/omci_vlan_config.go
@@ -65,7 +65,7 @@
 	cDoNotFilterEtherType uint32 = 0
 	cDoNotAddPrio         uint32 = 15
 	cCopyPrioFromInner    uint32 = 8
-	cDontCarePrio         uint32 = 0
+	//cDontCarePrio         uint32 = 0
 	cDontCareVid          uint32 = 0
 	cDontCareTpid         uint32 = 0
 	cSetOutputTpidCopyDei uint32 = 4
@@ -79,13 +79,13 @@
 	vlanEvStartConfig    = "vlanEvStartConfig"
 	vlanEvRxConfigVtfd   = "vlanEvRxConfigVtfd"
 	vlanEvRxConfigEvtocd = "vlanEvRxConfigEvtocd"
-	vlanEvCleanupConfig  = "vlanEvCleanupConfig"
-	vlanEvRxCleanVtfd    = "vlanEvRxCleanVtfd"
-	vlanEvRxCleanEvtocd  = "vlanEvRxCleanEvtocd"
-	vlanEvTimeoutSimple  = "vlanEvTimeoutSimple"
-	vlanEvTimeoutMids    = "vlanEvTimeoutMids"
-	vlanEvReset          = "vlanEvReset"
-	vlanEvRestart        = "vlanEvRestart"
+	//vlanEvCleanupConfig  = "vlanEvCleanupConfig"
+	//vlanEvRxCleanVtfd = "vlanEvRxCleanVtfd"
+	//vlanEvRxCleanEvtocd = "vlanEvRxCleanEvtocd"
+	//vlanEvTimeoutSimple = "vlanEvTimeoutSimple"
+	//vlanEvTimeoutMids = "vlanEvTimeoutMids"
+	vlanEvReset   = "vlanEvReset"
+	vlanEvRestart = "vlanEvRestart"
 )
 const (
 	// states of config PON ANI port FSM
@@ -237,10 +237,10 @@
 
 				if oFsm.pUniTechProf.getTechProfileDone(oFsm.pOnuUniPort.uniId, oFsm.techProfileID) {
 					// let the vlan processing begin
-					a_pAFsm.pFsm.Event(vlanEvStartConfig)
+					_ = a_pAFsm.pFsm.Event(vlanEvStartConfig)
 				} else {
 					// set to waiting for Techprofile
-					a_pAFsm.pFsm.Event(vlanEvWaitTechProf)
+					_ = a_pAFsm.pFsm.Event(vlanEvWaitTechProf)
 				}
 			}
 		}(pConfigVlanStateAFsm)
@@ -256,7 +256,7 @@
 		// obviously calling some FSM event here directly does not work - so trying to decouple it ...
 		pConfigVlanStateAFsm := oFsm.pAdaptFsm
 		go func(a_pAFsm *AdapterFsm) {
-			a_pAFsm.pFsm.Event(vlanEvRxConfigVtfd)
+			_ = a_pAFsm.pFsm.Event(vlanEvRxConfigVtfd)
 		}(pConfigVlanStateAFsm)
 	} else {
 		logger.Debugw("UniVlanConfigFsm create VTFD", log.Fields{
@@ -320,7 +320,7 @@
 		// obviously calling some FSM event here directly does not work - so trying to decouple it ...
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event(vlanEvReset)
+				_ = a_pAFsm.pFsm.Event(vlanEvReset)
 			}
 		}(pConfigVlanStateAFsm)
 	}
@@ -343,7 +343,7 @@
 		//try to restart the FSM to 'disabled', decouple event transfer
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event(vlanEvRestart)
+				_ = a_pAFsm.pFsm.Event(vlanEvRestart)
 			}
 		}(pConfigVlanStateAFsm)
 	}
@@ -361,34 +361,32 @@
 	logger.Debugw("Start UniVlanConfigFsm Msg processing", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 loop:
 	for {
-		select {
 		// case <-ctx.Done():
 		// 	logger.Info("MibSync Msg", log.Fields{"Message handling canceled via context for device-id": oFsm.pAdaptFsm.deviceID})
 		// 	break loop
-		case message, ok := <-oFsm.pAdaptFsm.commChan:
-			if !ok {
-				logger.Info("UniVlanConfigFsm Rx Msg - could not read from channel", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-				// but then we have to ensure a restart of the FSM as well - as exceptional procedure
-				oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
+		message, ok := <-oFsm.pAdaptFsm.commChan
+		if !ok {
+			logger.Info("UniVlanConfigFsm Rx Msg - could not read from channel", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+			// but then we have to ensure a restart of the FSM as well - as exceptional procedure
+			_ = oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
+			break loop
+		}
+		logger.Debugw("UniVlanConfigFsm Rx Msg", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+
+		switch message.Type {
+		case TestMsg:
+			msg, _ := message.Data.(TestMessage)
+			if msg.TestMessageVal == AbortMessageProcessing {
+				logger.Infow("UniVlanConfigFsm abort ProcessMsg", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 				break loop
 			}
-			logger.Debugw("UniVlanConfigFsm Rx Msg", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-
-			switch message.Type {
-			case TestMsg:
-				msg, _ := message.Data.(TestMessage)
-				if msg.TestMessageVal == AbortMessageProcessing {
-					logger.Infow("UniVlanConfigFsm abort ProcessMsg", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
-					break loop
-				}
-				logger.Warnw("UniVlanConfigFsm unknown TestMessage", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "MessageVal": msg.TestMessageVal})
-			case OMCI:
-				msg, _ := message.Data.(OmciMessage)
-				oFsm.handleOmciVlanConfigMessage(msg)
-			default:
-				logger.Warn("UniVlanConfigFsm Rx unknown message", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID,
-					"message.Type": message.Type})
-			}
+			logger.Warnw("UniVlanConfigFsm unknown TestMessage", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "MessageVal": msg.TestMessageVal})
+		case OMCI:
+			msg, _ := message.Data.(OmciMessage)
+			oFsm.handleOmciVlanConfigMessage(msg)
+		default:
+			logger.Warn("UniVlanConfigFsm Rx unknown message", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID,
+				"message.Type": message.Type})
 		}
 	}
 	logger.Infow("End UniVlanConfigFsm Msg processing", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
@@ -424,7 +422,7 @@
 				switch oFsm.pOmciCC.pLastTxMeInstance.GetName() {
 				case "VlanTaggingFilterData":
 					{ // let the FSM proceed ...
-						oFsm.pAdaptFsm.pFsm.Event(vlanEvRxConfigVtfd)
+						_ = oFsm.pAdaptFsm.pFsm.Event(vlanEvRxConfigVtfd)
 					}
 				}
 			}
@@ -492,7 +490,7 @@
 		if err != nil {
 			logger.Errorw("Evtocd set TPID failed, aborting VlanConfig FSM!",
 				log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-			oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
+			_ = oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
 			return
 		}
 	} //for local var
@@ -542,7 +540,7 @@
 		if err != nil {
 			logger.Errorw("Evtocd set transparent singletagged rule failed, aborting VlanConfig FSM!",
 				log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-			oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
+			_ = oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
 			return
 		}
 	} else {
@@ -592,7 +590,7 @@
 			if err != nil {
 				logger.Errorw("Evtocd set singletagged translation rule failed, aborting VlanConfig FSM!",
 					log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-				oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
+				_ = oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
 				return
 			}
 		} else {
@@ -643,7 +641,7 @@
 				if err != nil {
 					logger.Errorw("Evtocd set untagged->singletagged rule failed, aborting VlanConfig FSM!",
 						log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-					oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
+					_ = oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
 					return
 				}
 			} //just for local var's
@@ -693,7 +691,7 @@
 				if err != nil {
 					logger.Errorw("Evtocd set priotagged->singletagged rule failed, aborting VlanConfig FSM!",
 						log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-					oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
+					_ = oFsm.pAdaptFsm.pFsm.Event(vlanEvReset)
 					return
 				}
 			} //just for local var's
@@ -702,8 +700,7 @@
 
 	// if Config has been done for all GemPort instances let the FSM proceed
 	logger.Debugw("EVTOCD set loop finished", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-	oFsm.pAdaptFsm.pFsm.Event(vlanEvRxConfigEvtocd)
-	return
+	_ = oFsm.pAdaptFsm.pFsm.Event(vlanEvRxConfigEvtocd)
 }
 
 func (oFsm *UniVlanConfigFsm) waitforOmciResponse() error {
@@ -715,7 +712,7 @@
 		logger.Warnw("UniVlanConfigFsm multi entity timeout", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 		return errors.New("UniVlanConfigFsm multi entity timeout")
 	case success := <-oFsm.omciMIdsResponseReceived:
-		if success == true {
+		if success {
 			logger.Debug("UniVlanConfigFsm multi entity response received")
 			return nil
 		}
diff --git a/internal/pkg/onuadaptercore/onu_device_db.go b/internal/pkg/onuadaptercore/onu_device_db.go
index 4b80a94..def0dc3 100644
--- a/internal/pkg/onuadaptercore/onu_device_db.go
+++ b/internal/pkg/onuadaptercore/onu_device_db.go
@@ -37,37 +37,37 @@
 }
 
 //OnuDeviceDB returns a new instance for a specific ONU_Device_Entry
-func NewOnuDeviceDB(ctx context.Context, a_pOnuDeviceEntry *OnuDeviceEntry) *OnuDeviceDB {
-	logger.Debugw("Init OnuDeviceDB for:", log.Fields{"device-id": a_pOnuDeviceEntry.deviceID})
+func NewOnuDeviceDB(ctx context.Context, aPOnuDeviceEntry *OnuDeviceEntry) *OnuDeviceDB {
+	logger.Debugw("Init OnuDeviceDB for:", log.Fields{"device-id": aPOnuDeviceEntry.deviceID})
 	var onuDeviceDB OnuDeviceDB
 	onuDeviceDB.ctx = ctx
-	onuDeviceDB.pOnuDeviceEntry = a_pOnuDeviceEntry
+	onuDeviceDB.pOnuDeviceEntry = aPOnuDeviceEntry
 	onuDeviceDB.meDb = make(MeDbMap)
 
 	return &onuDeviceDB
 }
 
-func (onuDeviceDB *OnuDeviceDB) PutMe(meClassId me.ClassID, meEntityId uint16, meAttributes me.AttributeValueMap) {
+func (onuDeviceDB *OnuDeviceDB) PutMe(meClassID me.ClassID, meEntityID uint16, meAttributes me.AttributeValueMap) {
 
 	//filter out the OnuData
-	if me.OnuDataClassID == meClassId {
+	if me.OnuDataClassID == meClassID {
 		return
 	}
 
-	//logger.Debugw("Search for key data :", log.Fields{"deviceId": onuDeviceDB.pOnuDeviceEntry.deviceID, "meClassId": meClassId, "meEntityId": meEntityId})
-	meInstMap, ok := onuDeviceDB.meDb[meClassId]
+	//logger.Debugw("Search for key data :", log.Fields{"deviceId": onuDeviceDB.pOnuDeviceEntry.deviceID, "meClassID": meClassID, "meEntityID": meEntityID})
+	meInstMap, ok := onuDeviceDB.meDb[meClassID]
 	if !ok {
-		logger.Debugw("meClassId not found - add to db :", log.Fields{"device-id": onuDeviceDB.pOnuDeviceEntry.deviceID})
+		logger.Debugw("meClassID not found - add to db :", log.Fields{"device-id": onuDeviceDB.pOnuDeviceEntry.deviceID})
 		meInstMap = make(map[uint16]me.AttributeValueMap)
-		onuDeviceDB.meDb[meClassId] = meInstMap
-		onuDeviceDB.meDb[meClassId][meEntityId] = meAttributes
+		onuDeviceDB.meDb[meClassID] = meInstMap
+		onuDeviceDB.meDb[meClassID][meEntityID] = meAttributes
 	} else {
-		meAttribs, ok := onuDeviceDB.meDb[meClassId][meEntityId]
+		meAttribs, ok := meInstMap[meEntityID]
 		if !ok {
 			/* verbose logging, avoid in >= debug level
 			logger.Debugw("meEntityId not found - add to db :", log.Fields{"device-id": onuDeviceDB.pOnuDeviceEntry.deviceID})
 			*/
-			onuDeviceDB.meDb[meClassId][meEntityId] = meAttributes
+			meInstMap[meEntityID] = meAttributes
 		} else {
 			/* verbose logging, avoid in >= debug level
 			logger.Debugw("ME-Instance exists already: merge attribute data :", log.Fields{"device-id": onuDeviceDB.pOnuDeviceEntry.deviceID, "meAttribs": meAttribs})
@@ -75,7 +75,7 @@
 			for k, v := range meAttributes {
 				meAttribs[k] = v
 			}
-			onuDeviceDB.meDb[meClassId][meEntityId] = meAttribs
+			meInstMap[meEntityID] = meAttribs
 			/* verbose logging, avoid in >= debug level
 			logger.Debugw("ME-Instance updated :", log.Fields{"device-id": onuDeviceDB.pOnuDeviceEntry.deviceID, "meAttribs": meAttribs})
 			*/
@@ -83,17 +83,16 @@
 	}
 }
 
-func (onuDeviceDB *OnuDeviceDB) GetMe(meClassId me.ClassID, meEntityId uint16) me.AttributeValueMap {
+func (onuDeviceDB *OnuDeviceDB) GetMe(meClassID me.ClassID, meEntityID uint16) me.AttributeValueMap {
 
-	if meAttributes, present := onuDeviceDB.meDb[meClassId][meEntityId]; present {
+	if meAttributes, present := onuDeviceDB.meDb[meClassID][meEntityID]; present {
 		/* verbose logging, avoid in >= debug level
-		logger.Debugw("ME found:", log.Fields{"meClassId": meClassId, "meEntityId": meEntityId, "meAttributes": meAttributes,
+		logger.Debugw("ME found:", log.Fields{"meClassID": meClassID, "meEntityID": meEntityID, "meAttributes": meAttributes,
 			"device-id": onuDeviceDB.pOnuDeviceEntry.deviceID})
 		*/
 		return meAttributes
-	} else {
-		return nil
 	}
+	return nil
 }
 
 func (onuDeviceDB *OnuDeviceDB) GetUint32Attrib(meAttribute interface{}) (uint32, error) {
@@ -126,9 +125,9 @@
 
 func (onuDeviceDB *OnuDeviceDB) LogMeDb() {
 	logger.Debugw("ME instances stored for :", log.Fields{"device-id": onuDeviceDB.pOnuDeviceEntry.deviceID})
-	for meClassId, meInstMap := range onuDeviceDB.meDb {
-		for meEntityId, meAttribs := range meInstMap {
-			logger.Debugw("ME instance: ", log.Fields{"meClassId": meClassId, "meEntityId": meEntityId, "meAttribs": meAttribs, "device-id": onuDeviceDB.pOnuDeviceEntry.deviceID})
+	for meClassID, meInstMap := range onuDeviceDB.meDb {
+		for meEntityID, meAttribs := range meInstMap {
+			logger.Debugw("ME instance: ", log.Fields{"meClassID": meClassID, "meEntityID": meEntityID, "meAttribs": meAttribs, "device-id": onuDeviceDB.pOnuDeviceEntry.deviceID})
 		}
 	}
 }
diff --git a/internal/pkg/onuadaptercore/onu_device_entry.go b/internal/pkg/onuadaptercore/onu_device_entry.go
index 154e513..dfb056b 100644
--- a/internal/pkg/onuadaptercore/onu_device_entry.go
+++ b/internal/pkg/onuadaptercore/onu_device_entry.go
@@ -44,7 +44,7 @@
 	ulEvStart              = "ulEvStart"
 	ulEvResetMib           = "ulEvResetMib"
 	ulEvGetVendorAndSerial = "ulEvGetVendorAndSerial"
-	ulEvGetEquipmentId     = "ulEvGetEquipmentId"
+	ulEvGetEquipmentID     = "ulEvGetEquipmentId"
 	ulEvGetFirstSwVersion  = "ulEvGetFirstSwVersion"
 	ulEvGetSecondSwVersion = "ulEvGetSecondSwVersion"
 	ulEvGetMacAddress      = "ulEvGetMacAddress"
@@ -65,7 +65,7 @@
 	ulStStarting               = "ulStStarting"
 	ulStResettingMib           = "ulStResettingMib"
 	ulStGettingVendorAndSerial = "ulStGettingVendorAndSerial"
-	ulStGettingEquipmentId     = "ulStGettingEquipmentId"
+	ulStGettingEquipmentID     = "ulStGettingEquipmentID"
 	ulStGettingFirstSwVersion  = "ulStGettingFirstSwVersion"
 	ulStGettingSecondSwVersion = "ulStGettingSecondSwVersion"
 	ulStGettingMacAddress      = "ulStGettingMacAddress"
@@ -125,9 +125,9 @@
 )
 
 type activityDescr struct {
-	databaseClass   func() error
-	advertiseEvents bool
-	auditDelay      uint16
+	databaseClass func() error
+	//advertiseEvents bool
+	auditDelay uint16
 	//tasks           map[string]func() error
 }
 type OmciDeviceFsms map[string]activityDescr
@@ -157,12 +157,12 @@
 //OntDeviceEntry structure holds information about the attached FSM'as and their communication
 
 const (
-	FirstSwImageMeId  = 0
-	SecondSwImageMeId = 1
+	FirstSwImageMeID  = 0
+	SecondSwImageMeID = 1
 )
-const OnugMeId = 0
-const Onu2gMeId = 0
-const IpHostConfigDataMeId = 1
+const OnugMeID = 0
+const Onu2gMeID = 0
+const IPHostConfigDataMeID = 1
 const OnugSerialNumberLen = 8
 const OmciMacAddressLen = 6
 
@@ -183,7 +183,7 @@
 	vendorID           string
 	serialNumber       string
 	equipmentID        string
-	swImages           [SecondSwImageMeId + 1]SwImages
+	swImages           [SecondSwImageMeID + 1]SwImages
 	activeSwVersion    string
 	macAddress         string
 	//lockDeviceEntries           sync.RWMutex
@@ -232,8 +232,8 @@
 			"mib-synchronizer": {
 				//mibSyncFsm,        // Implements the MIB synchronization state machine
 				onuDeviceEntry.MibDbVolatileDict, // Implements volatile ME MIB database
-				true,                             // Advertise events on OpenOMCI event bus
-				60,                               // Time to wait between MIB audits.  0 to disable audits.
+				//true,                             // Advertise events on OpenOMCI event bus
+				60, // Time to wait between MIB audits.  0 to disable audits.
 				// map[string]func() error{
 				// 	"mib-upload":    onuDeviceEntry.MibUploadTask,
 				// 	"mib-template":  onuDeviceEntry.MibTemplateTask,
@@ -263,8 +263,8 @@
 
 			{Name: ulEvResetMib, Src: []string{ulStStarting}, Dst: ulStResettingMib},
 			{Name: ulEvGetVendorAndSerial, Src: []string{ulStResettingMib}, Dst: ulStGettingVendorAndSerial},
-			{Name: ulEvGetEquipmentId, Src: []string{ulStGettingVendorAndSerial}, Dst: ulStGettingEquipmentId},
-			{Name: ulEvGetFirstSwVersion, Src: []string{ulStGettingEquipmentId}, Dst: ulStGettingFirstSwVersion},
+			{Name: ulEvGetEquipmentID, Src: []string{ulStGettingVendorAndSerial}, Dst: ulStGettingEquipmentID},
+			{Name: ulEvGetFirstSwVersion, Src: []string{ulStGettingEquipmentID}, Dst: ulStGettingFirstSwVersion},
 			{Name: ulEvGetSecondSwVersion, Src: []string{ulStGettingFirstSwVersion}, Dst: ulStGettingSecondSwVersion},
 			{Name: ulEvGetMacAddress, Src: []string{ulStGettingSecondSwVersion}, Dst: ulStGettingMacAddress},
 			{Name: ulEvGetMibTemplate, Src: []string{ulStGettingMacAddress}, Dst: ulStGettingMibTemplate},
@@ -290,11 +290,11 @@
 			{Name: ulEvSuccess, Src: []string{ulStResynchronizing}, Dst: ulStInSync},
 			{Name: ulEvDiffsFound, Src: []string{ulStResynchronizing}, Dst: ulStOutOfSync},
 
-			{Name: ulEvTimeout, Src: []string{ulStResettingMib, ulStGettingVendorAndSerial, ulStGettingEquipmentId, ulStGettingFirstSwVersion,
+			{Name: ulEvTimeout, Src: []string{ulStResettingMib, ulStGettingVendorAndSerial, ulStGettingEquipmentID, ulStGettingFirstSwVersion,
 				ulStGettingSecondSwVersion, ulStGettingMacAddress, ulStGettingMibTemplate, ulStUploading, ulStResynchronizing, ulStExaminingMds,
 				ulStInSync, ulStOutOfSync, ulStAuditing}, Dst: ulStStarting},
 
-			{Name: ulEvStop, Src: []string{ulStStarting, ulStResettingMib, ulStGettingVendorAndSerial, ulStGettingEquipmentId, ulStGettingFirstSwVersion,
+			{Name: ulEvStop, Src: []string{ulStStarting, ulStResettingMib, ulStGettingVendorAndSerial, ulStGettingEquipmentID, ulStGettingFirstSwVersion,
 				ulStGettingSecondSwVersion, ulStGettingMacAddress, ulStGettingMibTemplate, ulStUploading, ulStResynchronizing, ulStExaminingMds,
 				ulStInSync, ulStOutOfSync, ulStAuditing}, Dst: ulStDisabled},
 		},
@@ -304,7 +304,7 @@
 			("enter_" + ulStStarting):               func(e *fsm.Event) { onuDeviceEntry.enterStartingState(e) },
 			("enter_" + ulStResettingMib):           func(e *fsm.Event) { onuDeviceEntry.enterResettingMibState(e) },
 			("enter_" + ulStGettingVendorAndSerial): func(e *fsm.Event) { onuDeviceEntry.enterGettingVendorAndSerialState(e) },
-			("enter_" + ulStGettingEquipmentId):     func(e *fsm.Event) { onuDeviceEntry.enterGettingEquipmentIdState(e) },
+			("enter_" + ulStGettingEquipmentID):     func(e *fsm.Event) { onuDeviceEntry.enterGettingEquipmentIDState(e) },
 			("enter_" + ulStGettingFirstSwVersion):  func(e *fsm.Event) { onuDeviceEntry.enterGettingFirstSwVersionState(e) },
 			("enter_" + ulStGettingSecondSwVersion): func(e *fsm.Event) { onuDeviceEntry.enterGettingSecondSwVersionState(e) },
 			("enter_" + ulStGettingMacAddress):      func(e *fsm.Event) { onuDeviceEntry.enterGettingMacAddressState(e) },
@@ -438,7 +438,7 @@
 }
 
 //Relay the InSync message via Handler to Rw core - Status update
-func (oo *OnuDeviceEntry) transferSystemEvent(dev_Event OnuDeviceEvent) error {
+func (oo *OnuDeviceEntry) transferSystemEvent(dev_Event OnuDeviceEvent) {
 	logger.Debugw("relaying system-event", log.Fields{"Event": dev_Event})
 	// decouple the handler transfer from further processing here
 	// TODO!!! check if really no synch is required within the system e.g. to ensure following steps ..
@@ -460,5 +460,4 @@
 	} else {
 		logger.Warnw("device-event not yet handled", log.Fields{"state": dev_Event})
 	}
-	return nil
 }
diff --git a/internal/pkg/onuadaptercore/onu_uni_tp.go b/internal/pkg/onuadaptercore/onu_uni_tp.go
index a5a8ba4..1a80441 100644
--- a/internal/pkg/onuadaptercore/onu_uni_tp.go
+++ b/internal/pkg/onuadaptercore/onu_uni_tp.go
@@ -26,7 +26,6 @@
 	"strings"
 	"sync"
 
-	"github.com/looplab/fsm"
 	"github.com/opencord/voltha-lib-go/v3/pkg/db"
 	"github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
@@ -77,15 +76,15 @@
 	schedPolicy uint8
 }
 type gemPortParamStruct struct {
-	ponOmciCC       bool
+	//ponOmciCC       bool
 	gemPortID       uint16
 	direction       uint8
 	gemPortEncState uint8
 	prioQueueIndex  uint8
 	pbitString      string
 	discardPolicy   string
-	//could also be a queue specific paramter, not used that way here
-	maxQueueSize     uint16
+	//could also be a queue specific parameter, not used that way here
+	//maxQueueSize     uint16
 	queueSchedPolicy string
 	queueWeight      uint8
 }
@@ -218,7 +217,7 @@
 // configureUniTp checks existing tp resources to delete and starts the corresponding OMCI configuation of the UNI port
 // all possibly blocking processing must be run in background to allow for deadline supervision!
 // but take care on sequential background processing when needed (logical dependencies)
-//   use waitForTimeoutOrCompletion(ctx, chTpConfigProcessingStep, processingStep) for internal synchronisation
+//   use waitForTimeoutOrCompletion(ctx, chTpConfigProcessingStep, processingStep) for internal synchronization
 func (onuTP *OnuUniTechProf) configureUniTp(ctx context.Context,
 	aUniID uint8, aPathString string, wg *sync.WaitGroup) {
 	defer wg.Done() //always decrement the waitGroup on return
@@ -286,10 +285,10 @@
 				logger.Debugw("tech-profile related configuration aborted on set",
 					log.Fields{"device-id": onuTP.deviceID, "UniId": aUniID})
 				onuTP.procResult = errors.New("TechProfile config aborted: Omci AniSideConfig failed")
-				//this issue here means that the AniConfigFsm has not finished succesfully
+				//this issue here means that the AniConfigFsm has not finished successfully
 				//which requires to reset it to allow for new usage, e.g. also on a different UNI
 				//(without that it would be reset on device down indication latest)
-				onuTP.pAniConfigFsm.pAdaptFsm.pFsm.Event(aniEvReset)
+				_ = onuTP.pAniConfigFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 				return
 			}
 		} else {
@@ -539,7 +538,7 @@
 	//note: the code is currently restricted to one TCcont per Onu (index [0])
 	//get the relevant values from the profile and store to mapPonAniConfig
 	(*(onuTP.mapPonAniConfig[aUniID]))[0].tcontParams.allocID = uint16(tpInst.UsScheduler.AllocID)
-	//maybe tCont scheduling not (yet) needed - just to basicaly have it for future
+	//maybe tCont scheduling not (yet) needed - just to basically have it for future
 	//  (would only be relevant in case of ONU-2G QOS configuration flexibility)
 	if tpInst.UsScheduler.QSchedPolicy == "StrictPrio" {
 		(*(onuTP.mapPonAniConfig[aUniID]))[0].tcontParams.schedPolicy = 1 //for the moment fixed value acc. G.988 //TODO: defines!
@@ -593,7 +592,7 @@
 		(*(onuTP.mapPonAniConfig[aUniID]))[0].mapGemPortParams[uint16(pos)].queueWeight =
 			uint8(content.Weight)
 	}
-	if loGemPortRead == false {
+	if !loGemPortRead {
 		logger.Errorw("PonAniConfig reject - no GemPort could be read from TechProfile",
 			log.Fields{"path": aPathString, "device-id": onuTP.deviceID})
 		//remove PonAniConfig  as done so far, delete map should be safe, even if not existing
@@ -601,7 +600,7 @@
 		onuTP.chTpConfigProcessingStep <- 0 //error indication
 		return
 	}
-	//TODO!! MC (downstream) GemPorts can be set using DownstreamGemPortAttributeList seperately
+	//TODO!! MC (downstream) GemPorts can be set using DownstreamGemPortAttributeList separately
 
 	//logger does not simply output the given structures, just give some example debug values
 	logger.Debugw("PonAniConfig read from TechProfile", log.Fields{
@@ -649,7 +648,7 @@
 	}
 }
 
-// createUniLockFsm initialises and runs the AniConfig FSM to transfer the OMCI related commands for ANI side configuration
+// createUniLockFsm initializes and runs the AniConfig FSM to transfer the OMCI related commands for ANI side configuration
 func (onuTP *OnuUniTechProf) createAniConfigFsm(aUniID uint8,
 	apCurrentUniPort *OnuUniPort, devEvent OnuDeviceEvent, aProcessingStep uint8) {
 	logger.Debugw("createAniConfigFsm", log.Fields{"device-id": onuTP.deviceID})
@@ -675,8 +674,7 @@
 	/*  Uni related ANI config procedure -
 	 ***** should run via 'aniConfigDone' state and generate the argument requested event *****
 	 */
-	var pACStatemachine *fsm.FSM
-	pACStatemachine = onuTP.pAniConfigFsm.pAdaptFsm.pFsm
+	pACStatemachine := onuTP.pAniConfigFsm.pAdaptFsm.pFsm
 	if pACStatemachine != nil {
 		if pACStatemachine.Is(aniStDisabled) {
 			//FSM init requirement to get informed abou FSM completion! (otherwise timeout of the TechProf config)
diff --git a/internal/pkg/onuadaptercore/openonu.go b/internal/pkg/onuadaptercore/openonu.go
index c9d4b37..28d124d 100644
--- a/internal/pkg/onuadaptercore/openonu.go
+++ b/internal/pkg/onuadaptercore/openonu.go
@@ -86,8 +86,8 @@
 		"mib-synchronizer": {
 			//mibSyncFsm,        // Implements the MIB synchronization state machine
 			MibDbVolatileDictImpl, // Implements volatile ME MIB database
-			true,                  // Advertise events on OpenOMCI event bus
-			cMibAuditDelayImpl,    // Time to wait between MIB audits.  0 to disable audits.
+			//true,                  // Advertise events on OpenOMCI event bus
+			cMibAuditDelayImpl, // Time to wait between MIB audits.  0 to disable audits.
 			// map[string]func() error{
 			// 	"mib-upload":    onuDeviceEntry.MibUploadTask,
 			// 	"mib-template":  onuDeviceEntry.MibTemplateTask,
@@ -126,11 +126,13 @@
 	}
 }
 
+/*
 func (oo *OpenONUAC) deleteDeviceHandlerToMap(agent *DeviceHandler) {
 	oo.lockDeviceHandlersMap.Lock()
 	defer oo.lockDeviceHandlersMap.Unlock()
 	delete(oo.deviceHandlers, agent.deviceID)
 }
+*/
 
 func (oo *OpenONUAC) getDeviceHandler(deviceID string) *DeviceHandler {
 	oo.lockDeviceHandlersMap.Lock()
diff --git a/internal/pkg/onuadaptercore/platform.go b/internal/pkg/onuadaptercore/platform.go
index 2aef6e1..7e6469c 100644
--- a/internal/pkg/onuadaptercore/platform.go
+++ b/internal/pkg/onuadaptercore/platform.go
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-//Package core provides the utility for olt devices, flows and statistics
+//Package adaptercoreonu provides the utility for onu devices, flows and statistics
 package adaptercoreonu
 
 //Attention: this file is more or less a coopy of file olt_platform.go from the voltha-openolt-adapter
@@ -98,8 +98,11 @@
 	bitsForONUID = 8
 	// Number of bits for PON ID
 	bitsForPONID = 8
-	// Number of bits to differentiate between UNI and NNI Logical Port
-	bitsForUNINNIDiff = 1
+	/*
+		// Number of bits to differentiate between UNI and NNI Logical Port
+		bitsForUNINNIDiff = 1
+	*/
+
 	//MaxOnusPerPon is Max number of ONUs on any PON port
 	MaxOnusPerPon = (1 << bitsForONUID)
 	//MaxPonsPerOlt is Max number of PON ports on any OLT
diff --git a/internal/pkg/onuadaptercore/uniportadmin.go b/internal/pkg/onuadaptercore/uniportadmin.go
index 8ff64ce..874bf86 100644
--- a/internal/pkg/onuadaptercore/uniportadmin.go
+++ b/internal/pkg/onuadaptercore/uniportadmin.go
@@ -76,7 +76,7 @@
 			"device-id": aDeviceID})
 		return nil
 	}
-	if aAdminState == true { //port locking requested
+	if aAdminState { //port locking requested
 		instFsm.pAdaptFsm.pFsm = fsm.NewFSM(
 			uniStDisabled,
 			fsm.Events{
@@ -183,7 +183,7 @@
 		// obviously calling some FSM event here directly does not work - so trying to decouple it ...
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event(uniEvStartAdmin)
+				_ = a_pAFsm.pFsm.Event(uniEvStartAdmin)
 			}
 		}(pLockStateAFsm)
 	}
@@ -191,7 +191,7 @@
 
 func (oFsm *LockStateFsm) enterSettingOnuGState(e *fsm.Event) {
 	var omciAdminState uint8 = 1 //default locked
-	if oFsm.adminState == false {
+	if !oFsm.adminState {
 		omciAdminState = 0
 	}
 	logger.Debugw("LockStateFSM Tx Set::ONU-G:admin", log.Fields{
@@ -222,7 +222,7 @@
 		// obviously calling some FSM event here directly does not work - so trying to decouple it ...
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event(uniEvReset)
+				_ = a_pAFsm.pFsm.Event(uniEvReset)
 			}
 		}(pLockStateAFsm)
 	}
@@ -245,7 +245,7 @@
 		// see DownloadedState: decouple event transfer
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event(uniEvRestart)
+				_ = a_pAFsm.pFsm.Event(uniEvRestart)
 			}
 		}(pLockStateAFsm)
 	}
@@ -255,34 +255,32 @@
 	logger.Debugw("Start LockStateFsm Msg processing", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 loop:
 	for {
-		select {
 		// case <-ctx.Done():
 		// 	logger.Info("MibSync Msg", log.Fields{"Message handling canceled via context for device-id": oFsm.pAdaptFsm.deviceID})
 		// 	break loop
-		case message, ok := <-oFsm.pAdaptFsm.commChan:
-			if !ok {
-				logger.Info("LockStateFsm Rx Msg - could not read from channel", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-				// but then we have to ensure a restart of the FSM as well - as exceptional procedure
-				oFsm.pAdaptFsm.pFsm.Event(uniEvRestart)
+		message, ok := <-oFsm.pAdaptFsm.commChan
+		if !ok {
+			logger.Info("LockStateFsm Rx Msg - could not read from channel", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+			// but then we have to ensure a restart of the FSM as well - as exceptional procedure
+			_ = oFsm.pAdaptFsm.pFsm.Event(uniEvRestart)
+			break loop
+		}
+		logger.Debugw("LockStateFsm Rx Msg", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+
+		switch message.Type {
+		case TestMsg:
+			msg, _ := message.Data.(TestMessage)
+			if msg.TestMessageVal == AbortMessageProcessing {
+				logger.Infow("LockStateFsm abort ProcessMsg", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 				break loop
 			}
-			logger.Debugw("LockStateFsm Rx Msg", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-
-			switch message.Type {
-			case TestMsg:
-				msg, _ := message.Data.(TestMessage)
-				if msg.TestMessageVal == AbortMessageProcessing {
-					logger.Infow("LockStateFsm abort ProcessMsg", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
-					break loop
-				}
-				logger.Warnw("LockStateFsm unknown TestMessage", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "MessageVal": msg.TestMessageVal})
-			case OMCI:
-				msg, _ := message.Data.(OmciMessage)
-				oFsm.handleOmciLockStateMessage(msg)
-			default:
-				logger.Warn("LockStateFsm Rx unknown message", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID,
-					"message.Type": message.Type})
-			}
+			logger.Warnw("LockStateFsm unknown TestMessage", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "MessageVal": msg.TestMessageVal})
+		case OMCI:
+			msg, _ := message.Data.(OmciMessage)
+			oFsm.handleOmciLockStateMessage(msg)
+		default:
+			logger.Warn("LockStateFsm Rx unknown message", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID,
+				"message.Type": message.Type})
 		}
 	}
 	logger.Infow("End LockStateFsm Msg processing", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
@@ -319,7 +317,7 @@
 			switch oFsm.pOmciCC.pLastTxMeInstance.GetName() {
 			case "OnuG":
 				{ // let the FSM proceed ...
-					oFsm.pAdaptFsm.pFsm.Event(uniEvRxOnugResp)
+					_ = oFsm.pAdaptFsm.pFsm.Event(uniEvRxOnugResp)
 				}
 			case "UniG", "VEIP":
 				{ // let the PPTP init proceed by stopping the wait function
@@ -335,7 +333,7 @@
 
 func (oFsm *LockStateFsm) performUniPortAdminSet() {
 	var omciAdminState uint8 = 1 //default locked
-	if oFsm.adminState == false {
+	if !oFsm.adminState {
 		omciAdminState = 0
 	}
 	//set UNI-G or VEIP AdminState
@@ -365,27 +363,26 @@
 		if err != nil {
 			logger.Errorw("PPTP Admin State set failed, aborting LockState set!",
 				log.Fields{"device-id": oFsm.pAdaptFsm.deviceID, "Port": uniNo})
-			oFsm.pAdaptFsm.pFsm.Event(uniEvReset)
+			_ = oFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 			return
 		}
 	} //for all UNI ports
 	// if Config has been done for all UNI related instances let the FSM proceed
 	// while we did not check here, if there is some port at all - !?
 	logger.Infow("PPTP config loop finished", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-	oFsm.pAdaptFsm.pFsm.Event(uniEvRxUnisResp)
-	return
+	_ = oFsm.pAdaptFsm.pFsm.Event(uniEvRxUnisResp)
 }
 
 func (oFsm *LockStateFsm) waitforOmciResponse(apMeInstance *me.ManagedEntity) error {
 	select {
-	// maybe be also some outside cancel (but no context modelled for the moment ...)
+	// maybe be also some outside cancel (but no context modeled for the moment ...)
 	// case <-ctx.Done():
 	// 		logger.Infow("LockState-bridge-init message reception canceled", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 	case <-time.After(30 * time.Second): //3s was detected to be to less in 8*8 bbsim test with debug Info/Debug
 		logger.Warnw("LockStateFSM uni-set timeout", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 		return errors.New("LockStateFsm uni-set timeout")
 	case success := <-oFsm.omciLockResponseReceived:
-		if success == true {
+		if success {
 			logger.Debug("LockStateFSM uni-set response received")
 			return nil
 		}
diff --git a/pkg/mocks/common.go b/pkg/mocks/common.go
index 3b2df29..546f2fe 100644
--- a/pkg/mocks/common.go
+++ b/pkg/mocks/common.go
@@ -21,12 +21,10 @@
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 )
 
-var logger log.Logger
-
 func init() {
 	// Setup this package so that it's log level can be modified at run time
 	var err error
-	logger, err = log.AddPackage(log.JSON, log.ErrorLevel, log.Fields{"pkg": "mocks"})
+	_, err = log.AddPackage(log.JSON, log.ErrorLevel, log.Fields{"pkg": "mocks"})
 	if err != nil {
 		panic(err)
 	}
