Finish initial revision of calculate_percentage.