function update(scope = globalScope, updateEverything = false) {
    willBeUpdatedSet(false);
    if (loading === true || layoutModeGet()) return;
    var updated = false;
    simulationArea.hover = undefined;
    // Update wires
    if (wireToBeChecked || updateEverything) {
        if (wireToBeChecked === 2) wireToBeChecked = 0; // this required due to timing issues
        else wireToBeChecked++;
        // WHY IS THIS REQUIRED ???? we are checking inside wire ALSO
        // Idea: we can just call length again instead of doing it during loop.
        var prevLength = scope.wires.length;
        for (let i = 0; i < scope.wires.length; i++) {
            scope.wires[i].checkConnections();
            if (scope.wires.length !== prevLength) {
                prevLength--;
                i--;
            }
        }
        scheduleUpdate();
    }
    // Update subcircuits
    if (updateSubcircuit || updateEverything) {
        for (let i = 0; i < scope.SubCircuit.length; i++) { scope.SubCircuit[i].reset(); }
        updateSubcircuitSet(false);
    }
    // Update UI position
    if (updatePosition || updateEverything) {
        for (let i = 0; i < updateOrder.length; i++) {
            for (let j = 0; j < scope[updateOrder[i]].length; j++) {
                updated |= scope[updateOrder[i]][j].update();
            }
        }
    }
    // Updates multiple objectselections and panes window
    if (updatePosition || updateEverything) {
        updateSelectionsAndPane(scope);
    }
    // Update MiniMap
    if (!embed && simulationArea.mouseDown && simulationArea.lastSelected && simulationArea.lastSelected !== globalScope.root) {
        if (!lightMode) { $('#miniMap').fadeOut('fast'); }
    }
    // Run simulation
    if (updateSimulation) {
        play();
    }
    // Show properties of selected element
    if (!embed && prevPropertyObjGet() !== simulationArea.lastSelected) {
        if (simulationArea.lastSelected && simulationArea.lastSelected.objectType !== 'Wire') {
            // ideas: why show properties of project in Nodes but not wires?
            if (simulationArea.lastSelected.newElement) simulationArea.lastSelected.label = '';
            showProperties(simulationArea.lastSelected);
        } else {
            // hideProperties();
        }
    }
    // Draw, render everything
    if (updateCanvas) {
        renderCanvas(scope);
    }
    updateSimulationSet(false);
    updateCanvas = false;
    updatePositionSet(false);
}
fn that calls update on everything else. If any change
is there, it resolves the circuit and draws it again.
Also updates simulations, selection, minimap, resolves
circuit and redraws canvas if required.
@param {Scope=} scope - the circuit to be updated
@param {boolean=} updateEverything - if true we update the wires, nodes and modules
@category engine