Working templates, and query handling