Enforce sort concern algorithm + code factorization

fix #17