Added code to calculate the group weights and group weight percentages