Now uses readTemplate() function to fix issues with multiple gallery implementations