remove direct uses of TMS in code patterns.  (use only defines)