Sort match cases