Added word frequency function