Corrected TF implementation to consider all docs in a class