Query cleanup

Renamed 'query' to 'filter', and removed the distinct() method.