Some more work on template sharing.