refine sorting