Expanded TM class + added tests