First sort and unique candicates.