added tfcount calculations and finalized idf.py