Removes doubles, and corrects an highlighting bug