;
                
                // Check if order is already correct
                let orderCorrect = currentNodes.length === finalNodes.length;
                if (orderCorrect) {
                    for (let i = 0; i < currentNodes.length; i++) {
                        if (currentNodes[i] !== finalNodes[i]) {
                            orderCorrect = false;
                            break;
                        }
                    }
                }
                
                if (order