Updated things for counting number of stage in each class.