Add first cut at query generation