add pmtf; add cmdline tool to run some of the functions, wai; more unit tests