Single datum case
Adding same datum case
Account for unosrted repeated data
Code cleanup