Add support for template query