Improve the use of templates