added function to calculate percentages