finally nailed average calculations