Made TM more functional