sort output array