implement basic querying and counting of data