getting queries to work