added ability to load templates from file