Serious mucking with template/container handling to handle mixed lists of templates and db refs.  Probably still bugs.