updated to include templates and fixed templatetags