reverted tsf.cpp to release code