refactoring autoupdate for template.xhtml