method added to create a list with the name of classes and its frequencies