finetunes the sorting