More robust CMS_TEMPLATE implementation
tmp