Slightly optimized the percentage calculation.