fixed convergence bug and made tofs dynamic
optimised tchi and factors in tofs
tchi compile error fix