added query generator