updated counting logic for group ave age