Improve sum, prod and mini/maximum by using extract