filled in findDistinctValues function