Add candidated sorting which fixes #4