              tbody.appendChild(list[i]);
                }
            }

            // Add event handlers to column headers.
            function addHandlers(element, column) {
                element.onclick = (e) => sortTable(column);
                element.onkeydown = (e) => {
                    if (e.key == 'Enter' || e.key == ' ') {
                        sortTable(column);
                        e.preventDefault();
                    }
                };
            }

            function onL