refactored all the templates