merged in selected code from new template