I'm fairly sure Ted recently added something to the default.cf.sub file that does all of this for you.  Why not reuse it ?