Reorganize to allow templates to share more.