templates, some improvements