copy the TM* classes to allow tests without circular deps
add some convenience methods
working version