support code for #102
added count_distinct
added test for count_distinct. closes #102