More work on template sharing.