improve templating system