refactored the templates