uniq done and edge cases handled