tidied up some type-template building functions.