Fix distinctness bug and add feature for both target and best being states.