general template code cleansing