Updated the template to actually run the queries in a stack