MSINM-78: Improve sorting