reverse sorting for final result