we are duplicating a lot of code here. We should probably have a function that does the query and takes a param (and return the results object).