improved some templating