implementation of templates