New query.js for generating query