Implementation of TM done, need some checks.