optimize code if possible ```// eRanConType prepares and returns Connection data fieldset
export const eRanConType = (object => {

	//create Connection fieldset
	const connectionType = {
		legend: 'Connection Type',
		class: 'lte',
		name: 'connection',
		default: object.eranConnection.Connection,
		rows: object.eranConnection.Connections,
		display: 'grid',
		width: '100%',
	}.createFieldsetSelect()
	const selectorCon = connectionType.querySelector('select')
	selectorCon.addEventListener('change', (evnt) => {
		object.eranConnection.Connection = evnt.target.value
	})

	//create bridge box
	const box = {
		id: 'bridge',
		legend: 'Choose if Bridge is used',
		class: 'lte',
		name: 'bridge',
		rows: object.eranConnection.Bridges,
		display: 'grid',
		width: '90%',
	}.createFieldsetRadio();
	box.querySelector('input').setAttribute('checked', '')
	box.addEventListener('change', (evnt) => {
		object.eranConnection.Bridge = evnt.target.value
	});

	//create port fieldset
	const port = {
		legend: 'Choose TnPort',
		class: 'lte',
		name: 'port',
		default: object.eranConnection.TnPort,
		rows: object.eranConnection.TnPorts,
		display: 'grid',
		width: '90%',
	}.createFieldsetSelect();
	const selectorPort = port.querySelector('select')
	selectorPort.addEventListener('change', (evnt) => {
	object.eranConnection.TnPort = evnt.target.value;
	});

	//create second port fieldset
	const port2 = {
		legend: 'Choose second TnPort',
		class: 'lte',
		name: 'port2',
		default: object.eranConnection.TnPort2,
		rows: object.eranConnection.TnPorts,
		display: 'grid',
		width: '90%',
		}.createFieldsetSelect();
	const selectorPort2 = port2.querySelector('select')
	selectorPort2.addEventListener('change', (evnt) => {
		object.eranConnection.TnPort2 = evnt.target.value;
	});

	//presave defaults
	const p1 = object.eranConnection.TnPort
	const p2 = object.eranConnection.TnPort2

	// Listener of changes in Connection Type
	const choosecon = connectionType.querySelector('select')
	choosecon.addEventListener('change', (evnt) => {
		const key = evnt.target.value
		console.log(Date.now(), key)
		if (key == 'Router') {
			object.eranConnection.TnPort2 = ''
			object.eranConnection.Bridge = 'No'
			object.eranConnection.TnPort = ''
			port.remove()
			port2.remove()
			box.remove()
			console.log(Date.now(), object.eranConnection.TnPort)
			console.log(Date.now(), object.eranConnection.TnPort2)
			return connectionType
		}
		connectionType.appendChild(box)
		connectionType.appendChild(port)
		let nodes = Object.keys(object.children)
		if (nodes.length === 2) {
			connectionType.appendChild(port2)
		}
		console.log(Date.now(), object.eranConnection.TnPort)
		console.log(Date.now(), object.eranConnection.TnPort2)
	})

	// Listener of changes in Bridge type
	const chooseBridgeInputs = box.querySelectorAll('input')
	chooseBridgeInputs.forEach(input => {
		input.addEventListener('change', (evnt) => {
			const key = evnt.target.getAttribute('value')
			let nodes = Object.keys(object.children)
			console.log(Date.now(), key)
			if (key === 'Source') {
				object.eranConnection.Bridge = 'Source'
				object.eranConnection.TnPort2 = ''
				object.eranConnection.TnPort = p1
				if (connectionType.contains(port)) {
					connectionType.removeChild(port)
				}
				if (connectionType.contains(port2)) {
					connectionType.removeChild(port2)
				}
				if (nodes.length === 2) {
					connectionType.appendChild(port)
				}
			}
			else if (key === 'Target'){
				object.eranConnection.Bridge = 'Target'
				object.eranConnection.TnPort = ''
				object.eranConnection.TnPort2 = p2
				if (connectionType.contains(port)) {
					connectionType.removeChild(port)
				}
				if (connectionType.contains(port2)) {
					connectionType.removeChild(port2)
				}
				if (nodes.length === 2) {
					connectionType.appendChild(port2)
				}
			}
			else {
				object.eranConnection.Bridge = 'No'
				if (connectionType.contains(port)) {
					connectionType.removeChild(port)
				}
				if (connectionType.contains(port2)) {
					connectionType.removeChild(port2)
				}
				object.eranConnection.TnPort = p1
				object.eranConnection.TnPort2 = p2
				connectionType.appendChild(port)
				if (nodes.length === 2) {
					connectionType.appendChild(port2)
				}
				}
			console.log(Date.now(), object.eranConnection.TnPort)
			console.log(Date.now(), object.eranConnection.TnPort2)
		})
    })

    //return
    return connectionType
})```