@Override
	public synchronized void handlePacket(Packet packet) {
		
		logger.debug("Handling " + packet);
		
		if (packet.getGroup().equals(PacketGroup.COMMAND)) {
			logger.debug("CMD packet found - adding to sender buffer");
			this.getPortSender().addToBuffer(packet);
			
		} else if (packet.getGroup().equals(PacketGroup.SENSOR_DATA)) {
			try {
				synchronized(this) {
					sensorValuesMap.put(packet.getSrcNodeId(), Integer.parseInt(packet.getValue()));
				}
				
				logger.debug("ValueMap updated - new entry is <" + packet.getSrcNodeId() + "," + Integer.parseInt(packet.getValue()) + ">");
				logger.debug("ValueMap size is now " + sensorValuesMap.size());
			} catch (NumberFormatException e) {
				logger.warn(packet + " corrupted");
			}
			
			// inform Admin Node about ALARM_DATA
			
			if (packet.getType().equals(PacketType.ALM)) {
				logger.debug("ALM data found - adding to sender buffer");
				this.getPortSender().addToBuffer(packet);
			}
			
		} else if (packet.getGroup().equals(PacketGroup.ACKNOWLEDGEMENT)) {
			logger.debug("Passing ACK to sender");
			
			((AbstractUdpPortSender) this.getPortSender()).passAck();
		} else if (packet.getGroup().equals(PacketGroup.QUERY)) {
			
			if (packet.getType().equals(PacketType.MAX)) {
				
				this.getPortSender().addToBuffer(new Packet(this.getId(), packet.getType(), getMaxSensorValue()));
				
			} else if (packet.getType().equals(PacketType.MIN)) {
				
				this.getPortSender().addToBuffer(new Packet(this.getId(), packet.getType(), getMinSensorValue()));
				
			} else if (packet.getType().equals(PacketType.AVG)) {
				
				this.getPortSender().addToBuffer(new Packet(this.getId(), packet.getType(), getAvgSensorValue()));
				
			} else {
				logger.warn("Wrong type of QUERY Packet Received");
			}
		
		} else {
			logger.warn("Wrong type group of Packet Received");
		}
	}