additional query templates and performance improvements