changes to query / distinct