revised code
Merge branch 'enh/NormalizeTPMrevisited' into experimental