Tweaked the setting of amdTemplateEngine.defaultPath so it doesn't get overridden if its already set, and added a buildCollection function.