Got the queries working