Fix function and data output so that the SSAD is in increasing order