added option for custom templates and extraAllowedContent