More work on template selection.