reworked with averages