templates and test code