.removeChild(a);
        URL.revokeObjectURL(url);
    }

    // Load a default piece when the page loads
    document.addEventListener('DOMContentLoaded', function() {
        // First create all the controls
        createAllLineControls(pieces.simpleMajor);
        console.log('Line controls created successfully');
        
        // Add event listeners for global controls
        ['root', 'chordLength', 'bpm'].forEach(id => {
            const element = document.getElementById(id);
            if (!ele