added alternative avg_prices function