// Unclear why this function just wraps sortClasses, but 'ClassSelectorChanged' is overloaded witha teacher version
function ClassSelectorChanged() { 
	sortClasses();
}

function getSelectedClassId() {
	let options = document.querySelector("#class_selector").querySelector("option");
	for (let i = options.length; i--;)
		if (options[i].selected)
			return options[i].value;
}

function ClassSelectorInit() {
	document.querySelector("#class_selector").addEventListener('change', ClassSelectorChanged);
	sortClasses();
}

window.addEventListener("load", ClassSelectorInit);

@@ -196,18 +196,20 @@
 Id() %7B%0A%09
-le
+cons
 t option
@@ -281,62 +281,32 @@
 on%22)
-;%0A%09for (let i = options.length; i--;)%0A%09%09if (
+.filter(option =%3E 
 option
-s%5Bi%5D
 .sel
@@ -315,11 +315,10 @@
 ted)
+;
 %0A
-%09%09
 %09ret
@@ -332,17 +332,67 @@
 ions
-%5Bi%5D.value
+.length %3E 0 ? options%5Boptions.length - 1%5D.value : undefined
 ;%0A%7D%0A

Refactor getSelectedClassId