modify to count for text file