Switch from a hard-coded sorting network for four fragments to an insertion sort, which should work for any number of fragments.
This is a first step toward general depth sorting.
This properly reflects the modularity of the code, and it simplifies indentation and syntax highlighting.