Intermediate changes: developing common code for top-level and internal
instantiation of templates. TODO: look at childTemplateMap ????