Implement calculating TF