better modularization of templates