public static Node sort(Node head) {
            //Since modifying stuff causes all instances to be modified, we need duplicates to be stored that are immutable
                final Node h = copy(head);
                final Node h3 = copy(head);
		if (head == null || head.next == null)
			return head;

		// count total number of elements, use this to check if we are at the end of the list
		int count = head.len()+1;
		Node l = head;
                
                Node merged=head;
                //Get the first Natural Run
		Node h1 = getSegment(l);  
                //if the entire sequence is already in sorted order, just return that sequence
                if(h1.len()==count){
                    return h1;
                }
                //Find Node where the list was cutoff and use this to start looking for 2nd natural run
                Node temp = findPos(h1,h);
                //Get the second Natural run
		Node h2 = getSegment(temp);
                //merge natural runs
		merged = merge(h1, h2);
                
                int len = merged.len()+1;
                //check if the two natural runs comprised the remainder of the list, if it did return the merged list
                if(merged.len()+1==count){
                     System.out.println("Finished bottom iteration of Mergesort, final seq is: ");
                merged.print();
                System.out.println();
                    return merged;
                }
                //if we still aren't at the end, get the node(remainder of LL) where the 2nd natural run ended.
                Node next = findPos(len,h3);
                System.out.println("Finished one iteration of Mergesort, now merging: ");
                merged.print();
                System.out.print("with ");
                next.print();
                System.out.println();
                //Now what we do is call the method again, using the linked list without the two natural runs we found
                //We will merge this result with what we find
		return merge(merged,sort(next));
	}