template copy and related stuff.