Slight re-factor of query templates, added n-gram generation.