Algorithm is faster, handles duplicates...kinda