move loadTemplates() outside of document.ready()