Major fix of tps costs. Verify correctness with python code. Tps costs should be correct now.