added function to calculate percentage