add distinct helper function