added sort2 for GMats