refactoring for proper loading of templates and consistancy