Fixes to jinja templates and relevance bugs