writing variables for constructing queries