Add query template support