void RestructureSystem()
        {
            //Rename and restructure segments and waypoints
            List <Segment> nSegments = new List <Segment>();
            int            itSeg     = 0;

            foreach (Transform tS in wps.transform.GetChild(0).transform)
            {
                Segment segment = tS.GetComponent <Segment>();
                if (segment != null)
                {
                    List <Waypoint> nWaypoints = new List <Waypoint>();
                    segment.id = itSeg;
                    segment.gameObject.name = "Segment-" + itSeg;

                    int itWp = 0;
                    foreach (Transform tW in segment.gameObject.transform)
                    {
                        Waypoint waypoint = tW.GetComponent <Waypoint>();
                        if (waypoint != null)
                        {
                            waypoint.Refresh(itWp, segment);
                            nWaypoints.Add(waypoint);
                            itWp++;
                        }
                    }

                    segment.waypoints = nWaypoints;
                    nSegments.Add(segment);
                    itSeg++;
                }
            }

            //Check if next segments still exist
            foreach (Segment segment in nSegments)
            {
                List <Segment> nNextSegments = new List <Segment>();
                foreach (Segment nextSeg in segment.nextSegments)
                {
                    if (nextSeg != null)
                    {
                        nNextSegments.Add(nextSeg);
                    }
                }
                segment.nextSegments = nNextSegments;
            }
            wps.segments = nSegments;

            //Check intersections
            List <Intersection> nIntersections = new List <Intersection>();
            int itInter = 0;

            foreach (Transform tI in wps.transform.GetChild(1).transform)
            {
                Intersection intersection = tI.GetComponent <Intersection>();
                if (intersection != null)
                {
                    intersection.id = itInter;
                    intersection.gameObject.name = "Intersection-" + itInter;
                    nIntersections.Add(intersection);
                    itInter++;
                }
            }
            wps.intersections = nIntersections;

            //Tell Unity that something changed and the scene has to be saved
            if (!EditorUtility.IsDirty(target))
            {
                EditorUtility.SetDirty(target);
            }

            Debug.Log("[Traffic Simulation] Successfully rebuilt the traffic system.");
        }