An advanced templating system