Add function to compose query string