Moved content from _TemplatedMixin into _AttachMixin and tidied it up.