added spec_count and average_rating functions and tests