added control structures to templating system