Quote:

still way too complex.




Not really. The only complicated bit is the QS() quick sort routine, which is a black box UDF.