added tm helper function